mldonkey-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...
Date: Wed, 14 Dec 2005 21:22:07 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Branch:         
Changes by:     spiralvoice <address@hidden>    05/12/14 21:22:07

Modified files:
        distrib        : ChangeLog 
        src/daemon/common: commonComplexOptions.ml commonInteractive.ml 
                           commonSources.ml commonStats.ml 
        src/daemon/driver: driverCommands.ml driverInteractive.ml 
        src/gtk/gui    : gui_downloads.ml 
        src/gtk/newgui : gui_downloads.ml gui_friends.ml gui_graph.ml 
        src/utils/lib  : date.ml 
        src/utils/ocamlrss: rss_date.ml rss_date.mli 

Log message:
        patch #4702

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/distrib/ChangeLog.diff?tr1=1.614&tr2=1.615&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonComplexOptions.ml.diff?tr1=1.39&tr2=1.40&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonInteractive.ml.diff?tr1=1.57&tr2=1.58&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonSources.ml.diff?tr1=1.31&tr2=1.32&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonStats.ml.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/driver/driverCommands.ml.diff?tr1=1.103&tr2=1.104&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/driver/driverInteractive.ml.diff?tr1=1.53&tr2=1.54&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/gtk/gui/gui_downloads.ml.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/gtk/newgui/gui_downloads.ml.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/gtk/newgui/gui_friends.ml.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/gtk/newgui/gui_graph.ml.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/utils/lib/date.ml.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/utils/ocamlrss/rss_date.ml.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/utils/ocamlrss/rss_date.mli.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: mldonkey/distrib/ChangeLog
diff -u mldonkey/distrib/ChangeLog:1.614 mldonkey/distrib/ChangeLog:1.615
--- mldonkey/distrib/ChangeLog:1.614    Wed Dec 14 21:17:46 2005
+++ mldonkey/distrib/ChangeLog  Wed Dec 14 21:22:07 2005
@@ -12,6 +12,7 @@
 http://mldonkey.berlios.de/modules.php?name=Wiki&pagename=Windows
 
 2005/12/14
+4702: Correct timezone in e-mail, nicer uptime, timezone and uptime in runinfo
 4694: Fix lots of compile warnings in Ocaml 3.09
 4705: Update config.guess and config.sub to version 2005-11-11
       Mozilla MLdonkey Protocol Handler updated to version 1.7
Index: mldonkey/src/daemon/common/commonComplexOptions.ml
diff -u mldonkey/src/daemon/common/commonComplexOptions.ml:1.39 
mldonkey/src/daemon/common/commonComplexOptions.ml:1.40
--- mldonkey/src/daemon/common/commonComplexOptions.ml:1.39     Fri Dec  2 
12:02:36 2005
+++ mldonkey/src/daemon/common/commonComplexOptions.ml  Wed Dec 14 21:22:07 2005
@@ -1152,8 +1152,10 @@
       ^  "\nServer usage: " ^ (if !!enable_servers then "enabled" else 
"disabled (you are not able to connect to ED2K Servers)")
       ^ (let uname = Unix32.uname () in
           if uname <> "" then Printf.sprintf "\nSystem info: %s" uname else "")
+      ^ "\nUptime: " ^ Date.time_to_string (last_time () - start_time) 
"verbose"
       ^ "\nLanguage: " ^ Charset.default_language
       ^ " - locale: " ^ Charset.locstr
+      ^ " - UTC offset: " ^ Rss_date.mk_timezone (Unix.time ())
       ^ "\n max_string_length: " ^ string_of_int Sys.max_string_length
       ^ " - word_size: " ^ string_of_int Sys.word_size
       ^ " - max_array_length: " ^ string_of_int Sys.max_array_length
@@ -1161,14 +1163,7 @@
       ^ " - max useable file size: " ^ 
            (match Unix2.c_sizeofoff_t () with
             | 4 -> "2GB"
-
             |  _ -> Printf.sprintf "2^%d-1 bits (do the maths ;-p)" 
((Unix2.c_sizeofoff_t () *8)-1)
-
-(*
-            | _ -> Printf.sprintf "%s"
-              ((*size_of_int64*)(string_of_float(((2. ** 
(float_of_int((Unix2.c_sizeofoff_t () * 8)-1))) -. 1.)/. 8.)))
-*)
-
             )
   )    
   
\ No newline at end of file
Index: mldonkey/src/daemon/common/commonInteractive.ml
diff -u mldonkey/src/daemon/common/commonInteractive.ml:1.57 
mldonkey/src/daemon/common/commonInteractive.ml:1.58
--- mldonkey/src/daemon/common/commonInteractive.ml:1.57        Wed Dec 14 
21:17:46 2005
+++ mldonkey/src/daemon/common/commonInteractive.ml     Wed Dec 14 21:22:07 2005
@@ -248,11 +248,11 @@
     let info = file_info file in
     let line1 = "mldonkey has completed the download of:\r\n\r\n" in
 
-    let line2 = Printf.sprintf "\r\nFile: %s\r\nSize: %Ld bytes\r\nHash: 
%s\r\nFile was downloaded in%s\r\n"
+    let line2 = Printf.sprintf "\r\nFile: %s\r\nSize: %Ld bytes\r\nHash: 
%s\r\nFile was downloaded in %s\r\n"
       (file_best_name file)
       (file_size file)
       (string_of_uids info.G.file_uids)
-      (let age = (BasicSocket.last_time ()) - info.G.file_age in 
Date.time_to_string_long age)
+      (let age = (BasicSocket.last_time ()) - info.G.file_age in 
Date.time_to_string age "verbose")
     in
 
     let line3 = if (file_comment file) = "" then "" else
Index: mldonkey/src/daemon/common/commonSources.ml
diff -u mldonkey/src/daemon/common/commonSources.ml:1.31 
mldonkey/src/daemon/common/commonSources.ml:1.32
--- mldonkey/src/daemon/common/commonSources.ml:1.31    Wed Dec 14 21:17:46 2005
+++ mldonkey/src/daemon/common/commonSources.ml Wed Dec 14 21:22:07 2005
@@ -467,7 +467,6 @@
 
 
        let print buf output_type =
-        let timer = Unix.localtime (float_of_int(last_time ()) +. 1000000000.) 
in
         let pos_to_string v =
           (if v > 0 then string_of_int(v) else "-")
         in
@@ -493,7 +492,7 @@
             Printf.bprintf buf "\\<tr\\>";
             html_mods_td buf [
               ("", "srh", "Statistics on sources ");
-              ("", "srh", "@ " ^(Date.time_to_string_short timer));
+              ("", "srh", "@ " ^ log_time ());
               ("", "srh", header); ];
             Printf.bprintf buf "\\</tr\\>\\</table\\>\\</div\\>\n";
 
Index: mldonkey/src/daemon/common/commonStats.ml
diff -u mldonkey/src/daemon/common/commonStats.ml:1.1 
mldonkey/src/daemon/common/commonStats.ml:1.2
--- mldonkey/src/daemon/common/commonStats.ml:1.1       Mon Nov  7 20:11:42 2005
+++ mldonkey/src/daemon/common/commonStats.ml   Wed Dec 14 21:22:07 2005
@@ -58,18 +58,8 @@
     max 0.0 (100. *. (Int64.to_float x /. Int64.to_float y))
 
 let build_title n t uptime =
-  let one_minute = 60 in
-  let one_hour = 3600 in
-  let one_day = 86400 in
-
-  let days = uptime / one_day in
-  let rem = max 1 (uptime - days * one_day) in
-
-  let hours = rem / one_hour in
-  let rem = rem - hours * one_hour in
-  let mins = rem / one_minute in
 
-  let b = Printf.sprintf "%s Uptime: %d days, %02dh:%02dm" t days hours mins in
+  let b = Printf.sprintf "%s Uptime: %s" t (Date.time_to_string uptime 
"verbose") in
   let c = Printf.sprintf "%d seconds" uptime in
 
   [n;b;c]
Index: mldonkey/src/daemon/driver/driverCommands.ml
diff -u mldonkey/src/daemon/driver/driverCommands.ml:1.103 
mldonkey/src/daemon/driver/driverCommands.ml:1.104
--- mldonkey/src/daemon/driver/driverCommands.ml:1.103  Wed Dec 14 21:17:46 2005
+++ mldonkey/src/daemon/driver/driverCommands.ml        Wed Dec 14 21:22:07 2005
@@ -435,8 +435,8 @@
 
     "uptime", Arg_none (fun o ->
         let buf = o.conn_buf in
-        let uptime = log_time () ^ "- up" ^
-         Date.time_to_string_long (last_time () - start_time) in
+        let uptime = log_time () ^ "- up " ^
+         Date.time_to_string (last_time () - start_time) "verbose" in
         if o.conn_output = HTML then
           begin
             Printf.bprintf buf "\\<div class=\\\"cs\\\"\\>";
Index: mldonkey/src/daemon/driver/driverInteractive.ml
diff -u mldonkey/src/daemon/driver/driverInteractive.ml:1.53 
mldonkey/src/daemon/driver/driverInteractive.ml:1.54
--- mldonkey/src/daemon/driver/driverInteractive.ml:1.53        Sun Oct 30 
21:10:18 2005
+++ mldonkey/src/daemon/driver/driverInteractive.ml     Wed Dec 14 21:22:07 2005
@@ -655,13 +655,13 @@
 
 
           (if !!html_mods_vd_age then
-                       ctd file.file_num (let age = (BasicSocket.last_time ()) 
- file.file_age in Date.time_to_string_long age)
+                       ctd file.file_num (let age = (BasicSocket.last_time ()) 
- file.file_age in Date.time_to_string age "long")
                   else "");
 
           (if !!html_mods_vd_last then
                        ctd file.file_num (if file.file_last_seen > 0
              then let last = (BasicSocket.last_time ()) - file.file_last_seen 
in
-                Date.time_to_string_long last
+                Date.time_to_string last "long"
              else "-"
                )
                        else ""
@@ -677,7 +677,7 @@
           );
 
           (ctd file.file_num (if (file.file_download_rate < 10.24 || stalled 
file) then "-"
-                               else Date.time_to_string_long (calc_file_eta 
file)) );
+                               else Date.time_to_string (calc_file_eta file) 
"long"));
 
           (if !!html_mods_vd_prio then
              (Printf.sprintf "\\<td class=\\\"dl ar\\\"\\>\\<div 
id=\\\"divSelectPriority%d\\\"\\>\\<select id=\\\"selectPriority%d\\\" 
name=\\\"selectPriority%d\\\"
Index: mldonkey/src/gtk/gui/gui_downloads.ml
diff -u mldonkey/src/gtk/gui/gui_downloads.ml:1.8 
mldonkey/src/gtk/gui/gui_downloads.ml:1.9
--- mldonkey/src/gtk/gui/gui_downloads.ml:1.8   Fri Aug 26 21:10:43 2005
+++ mldonkey/src/gtk/gui/gui_downloads.ml       Wed Dec 14 21:22:07 2005
@@ -303,18 +303,18 @@
       | Col_file_network -> Gui_global.network_name f.file_network
       |        Col_file_age ->
           let age = (BasicSocket.last_time ()) - f.file_age in
-          Date.time_to_string_long age
+          Date.time_to_string age "long"
       |        Col_file_last_seen ->
           if f.file_last_seen > 0
           then let last = (BasicSocket.last_time ())
               - f.file_last_seen in
-            Date.time_to_string_long last
+            Date.time_to_string last "long"
           else Printf.sprintf "---"
       | Col_file_eta ->
           let eta = calc_file_eta f in
           if eta >= 1000 * 60 * 60 * 24 then
             Printf.sprintf "---"
-          else Date.time_to_string_long eta
+          else Date.time_to_string eta "long"
       |        Col_file_priority ->
           Printf.sprintf "%3d" f.file_priority
     
Index: mldonkey/src/gtk/newgui/gui_downloads.ml
diff -u mldonkey/src/gtk/newgui/gui_downloads.ml:1.14 
mldonkey/src/gtk/newgui/gui_downloads.ml:1.15
--- mldonkey/src/gtk/newgui/gui_downloads.ml:1.14       Fri Aug 26 21:10:43 2005
+++ mldonkey/src/gtk/newgui/gui_downloads.ml    Wed Dec 14 21:22:07 2005
@@ -314,7 +314,7 @@
 let time_to_string time =
   if time = max_last_seen 
     then "--"
-    else Date.time_to_string_long time
+    else Date.time_to_string time "long"
 
 let max_eta = 1000.0 *. 60.0 *. 60.0 *. 24.0
     
Index: mldonkey/src/gtk/newgui/gui_friends.ml
diff -u mldonkey/src/gtk/newgui/gui_friends.ml:1.15 
mldonkey/src/gtk/newgui/gui_friends.ml:1.16
--- mldonkey/src/gtk/newgui/gui_friends.ml:1.15 Sun Sep 18 20:14:48 2005
+++ mldonkey/src/gtk/newgui/gui_friends.ml      Wed Dec 14 21:22:07 2005
@@ -299,7 +299,7 @@
             Known_location _ -> M.fT_tx_direct
           | _ -> "")
       | Col_client_rating -> string_of_int f.gclient_rating
-      | Col_client_connect_time -> Date.time_to_string_long 
(f.gclient_connect_time)
+      | Col_client_connect_time -> Date.time_to_string 
(f.gclient_connect_time) "long"
       | Col_client_software -> f.gclient_software
       | Col_client_release -> f.gclient_release
       | Col_client_emulemod -> f.gclient_emulemod
Index: mldonkey/src/gtk/newgui/gui_graph.ml
diff -u mldonkey/src/gtk/newgui/gui_graph.ml:1.2 
mldonkey/src/gtk/newgui/gui_graph.ml:1.3
--- mldonkey/src/gtk/newgui/gui_graph.ml:1.2    Fri Aug 26 21:10:43 2005
+++ mldonkey/src/gtk/newgui/gui_graph.ml        Wed Dec 14 21:22:07 2005
@@ -259,7 +259,7 @@
       grid_pixmap#line
         ~x:0 ~y:(!height - a - 1) ~x:!width ~y:(!height - a - 1);
       grid_pixmap#string
-        (Date.time_to_string_long (a * !download_timeout / 1000))
+        (Date.time_to_string (a * !download_timeout / 1000) "long")
          ~font:!font ~x:(a + 2) ~y:(!height - 2);
       if a > 0 then
         grid_pixmap#string
@@ -351,7 +351,7 @@
       grid_pixmap#line
         ~x:0 ~y:(!height - a - 1) ~x:!width ~y:(!height - a - 1);
       grid_pixmap#string
-        (Date.time_to_string_long (a * !upload_timeout / 1000))
+        (Date.time_to_string (a * !upload_timeout / 1000) "long")
         ~font:!font ~x:(a + 2) ~y:(!height - 2);
       if a > 0 then
         grid_pixmap#string
Index: mldonkey/src/utils/lib/date.ml
diff -u mldonkey/src/utils/lib/date.ml:1.7 mldonkey/src/utils/lib/date.ml:1.8
--- mldonkey/src/utils/lib/date.ml:1.7  Fri Aug 26 21:10:43 2005
+++ mldonkey/src/utils/lib/date.ml      Wed Dec 14 21:22:07 2005
@@ -1,4 +1,4 @@
-type date_format = 
+type date_format =
   Second
 | Minute
 | Hour
@@ -13,7 +13,7 @@
 | Dot
 | Minus
 | Zone
-  
+
 let months = [| "Jan"; "Feb"; "Mar"; "Apr"; "May"; "Jun";
                 "Jul"; "Aug"; "Sep"; "Oct"; "Nov"; "Dec"|]
 
@@ -22,7 +22,7 @@
 let month = ref (fun n -> months.(n))
 let day = ref (fun n -> days.(n))
   
-let string_of_date formats tm =
+let string_of_date formats tm date =
   List.fold_left (fun s format ->
       match format with
         Second -> Printf.sprintf "%s%02d" s tm.Unix.tm_sec
@@ -38,53 +38,53 @@
       | Colon -> s ^ ":"
       | Dot -> s ^ "."
       | Minus -> s ^ "-"
-      | Zone -> s ^ "-0000" (* BUG: RFC 2822: Though "-0000" also indicates 
Universal Time, it is
-         used to indicate that the time was generated on a system that may be
-           in a local time zone other than Universal Time and therefore
-              indicates that the date-time contains no information about the 
local
-                 time zone. *)
+      | Zone -> Printf.sprintf "%s%s" s (Rss_date.mk_timezone date)
   ) "" formats
 
   
 let to_string date =
   string_of_date [Hour;Colon;Minute;Space; Space; WeekDay; Space; Day; 
Space;Month;]
-    (Unix.localtime date)
+    (Unix.localtime date) date
     
 let to_full_string date =
   string_of_date [Hour;Colon;Minute;Space; Space; WeekDay; Space; Day; 
Space;Month; Space;Year]
-    (Unix.localtime date)
+    (Unix.localtime date) date
 
 let simple date = 
   string_of_date [Hour;Colon;Minute;Colon;Second;Space; Space; WeekDay]
-    (Unix.localtime date)
+    (Unix.localtime date) date
 
 let reverse date = 
   string_of_date [Year;MonthNumber;Day;Minus;Hour;Minute;Second]
-    (Unix.localtime date)
+    (Unix.localtime date) date
   
 let mail_string date =
     string_of_date 
[WeekDay;Comma;Space;Day;Space;Month;Space;Year;Space;Hour;Colon;Minute;Colon;Second;Space;Zone]
-      (Unix.localtime date)
+      (Unix.localtime date) date
 
 let hour_in_secs = 3600
 let day_in_secs = 24 * hour_in_secs
 let year_in_secs = 365 * day_in_secs
 
-let time_to_string_short time =
-  Printf.sprintf "%02d:%02d:%02d"
-    time.Unix.tm_hour
-    time.Unix.tm_min
-    time.Unix.tm_sec
-
-let time_to_string_long time =
+let time_to_string time print_format =
   let days = time / 60 / 60 / 24 in
   let rest = time - days * 60 * 60 * 24 in
   let hours = rest / 60 / 60 in
   let rest = rest - hours * 60 * 60 in
   let minutes = rest / 60 in
   let seconds = rest - minutes * 60 in
-    if days > 0
-    then Printf.sprintf " %dd " days
-    else if hours > 0
-    then Printf.sprintf " %d:%02d:%02d " hours minutes seconds
-    else Printf.sprintf " %d:%02d " minutes seconds
+  match print_format with
+    "long" ->
+       if days > 0 then
+         Printf.sprintf " %dd " days
+       else
+         if hours > 0 then
+           Printf.sprintf " %dh:%02d " hours minutes
+         else
+           Printf.sprintf " %dm:%02d " minutes seconds
+  | "verbose" ->
+       Printf.sprintf "%s%s%dm %ds"
+         (if days > 0 then (string_of_int days) ^ "d " else "")
+         (if hours > 0 then (string_of_int hours) ^ "h " else "")
+         minutes seconds
+  | _ -> ""
Index: mldonkey/src/utils/ocamlrss/rss_date.ml
diff -u mldonkey/src/utils/ocamlrss/rss_date.ml:1.1 
mldonkey/src/utils/ocamlrss/rss_date.ml:1.2
--- mldonkey/src/utils/ocamlrss/rss_date.ml:1.1 Thu Jul 29 10:25:34 2004
+++ mldonkey/src/utils/ocamlrss/rss_date.ml     Wed Dec 14 21:22:07 2005
@@ -618,3 +618,7 @@
 let mk_usenet_date ?zone t =
   format "%A, %d-%b-%y %H:%M:%S %z" (create ?zone t)
 ;;
+
+let mk_timezone t =
+  format "%z" (create ~zone:localzone t)
+;;
Index: mldonkey/src/utils/ocamlrss/rss_date.mli
diff -u mldonkey/src/utils/ocamlrss/rss_date.mli:1.1 
mldonkey/src/utils/ocamlrss/rss_date.mli:1.2
--- mldonkey/src/utils/ocamlrss/rss_date.mli:1.1        Thu Jul 29 10:25:34 2004
+++ mldonkey/src/utils/ocamlrss/rss_date.mli    Wed Dec 14 21:22:07 2005
@@ -171,3 +171,5 @@
    * Note that this format has only two digits for the year.
    *)
 
+val mk_timezone : float -> string
+  (* Return a string with the current timezone as string, example "-0500" *)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]