$OpenBSD: patch-ubase_util_ml,v 1.1 2005/05/30 19:27:45 sturm Exp $
Post-release developer patch.
o Catch failure of localtime library call.
  See http://lists.seas.upenn.edu/pipermail/unison-hackers/2005-May/000092.html
o Fix the order of looking for home directory.
  See http://lists.seas.upenn.edu/pipermail/unison-hackers/2005-May/000088.html
--- ubase/util.ml.orig	Sat Mar 12 11:17:58 2005
+++ ubase/util.ml	Fri May 27 18:07:18 2005
@@ -244,14 +244,18 @@ let time () =
   convertUnixErrorsToTransient "time" Unix.time
 
 let time2string timef =
-  let time = localtime timef in
-  Printf.sprintf
-    "%2d:%.2d on %2d %3s, %4d"
-    time.Unix.tm_hour
-    time.Unix.tm_min
-    time.Unix.tm_mday
-    (monthname time.Unix.tm_mon)
-    (time.Unix.tm_year + 1900)
+  try
+    let time = localtime timef in
+    Printf.sprintf
+      "%2d:%.2d:%.2d on %2d %3s, %4d"
+      time.Unix.tm_hour
+      time.Unix.tm_min
+      time.Unix.tm_sec
+      time.Unix.tm_mday
+      (monthname time.Unix.tm_mon)
+      (time.Unix.tm_year + 1900)
+  with Transient _ ->
+    "(invalid date)"
 
 let percentageOfTotal current total =
   (int_of_float ((float current) *. 100.0 /. (float total)))
@@ -364,11 +368,11 @@ let fileInHomeDir n =
     Filename.concat (safeGetenv "HOME") n
   else if osType = `Win32 then
     let dirString =
-      try Unix.getenv "UNISON" (* Use UNISON dir if it is set *)
+      try Unix.getenv "USERPROFILE" (* Windows NT/2K standard *)
       with Not_found ->
       try Unix.getenv "HOME" (* Windows 9x with Cygwin HOME set *)
       with Not_found ->
-      try Unix.getenv "USERPROFILE" (* Windows NT/2K standard *)
+      try Unix.getenv "UNISON" (* Use UNISON dir if it is set *)
       with Not_found ->
       "c:/" (* Default *) in
     Filename.concat dirString n
