Index: /trunk/include/regfi.h
===================================================================
--- /trunk/include/regfi.h	(revision 250)
+++ /trunk/include/regfi.h	(revision 251)
@@ -191,10 +191,10 @@
  */
  /* Minimum time is Jan 1, 1990 00:00:00 */
-#define REGFI_MTIME_MIN_HIGH       0x01B41E6D
+#define REGFI_MTIME_MIN            0x01B41E6D00000000L
 
  /* Maximum time is Jan 1, 2290 00:00:00
   * (We hope no one is using Windows by then...) 
   */
-#define REGFI_MTIME_MAX_HIGH       0x03047543
+#define REGFI_MTIME_MAX            0x0304754300000000L
 
 
@@ -270,5 +270,5 @@
 		    : ~ (time_t) 0 << (sizeof (time_t) * CHAR_BIT - 1))
 #define TIME_T_MAX (~ (time_t) 0 - TIME_T_MIN)
-#define TIME_FIXUP_CONSTANT (369.0*365.25*24*60*60-(3.0*24*60*60+6.0*60*60))
+#define REGFI_TIME_FIXUP (369.0*365.25*24*60*60-(3.0*24*60*60+6.0*60*60))
 
 
@@ -278,10 +278,5 @@
 /******************************************************************************/
 
-typedef struct _regfi_nttime
-{
-  uint32_t low;
-  uint32_t high;
-} REGFI_NTTIME;
-
+typedef uint64_t REGFI_NTTIME;
 
 typedef struct _regfi_log
@@ -1731,7 +1726,7 @@
 /* XXX: move to base API and document */
 _EXPORT()
-void                  regfi_unix2nt_time(REGFI_NTTIME* nt, time_t t);
-_EXPORT()
-double                regfi_nt2unix_time(const REGFI_NTTIME* nt);
+REGFI_NTTIME          regfi_unix2nt_time(time_t t);
+_EXPORT()
+double                regfi_nt2unix_time(REGFI_NTTIME nt);
 
 
Index: /trunk/lib/regfi.c
===================================================================
--- /trunk/lib/regfi.c	(revision 250)
+++ /trunk/lib/regfi.c	(revision 251)
@@ -2753,6 +2753,6 @@
   ret_val->sequence1 = IVAL(file_header, 0x4);
   ret_val->sequence2 = IVAL(file_header, 0x8);
-  ret_val->mtime.low = IVAL(file_header, 0xC);
-  ret_val->mtime.high = IVAL(file_header, 0x10);
+  ret_val->mtime = ((uint64_t)IVAL(file_header, 0x10)) << 32;
+  ret_val->mtime |= IVAL(file_header, 0xC);
   ret_val->major_version = IVAL(file_header, 0x14);
   ret_val->minor_version = IVAL(file_header, 0x18);
@@ -2936,6 +2936,6 @@
   }
 
-  ret_val->mtime.low = IVAL(nk_header, 0x4);
-  ret_val->mtime.high = IVAL(nk_header, 0x8);
+  ret_val->mtime = ((uint64_t)IVAL(nk_header, 0x8)) << 32;
+  ret_val->mtime |= IVAL(nk_header, 0x4);
   /* If the key is unallocated and the MTIME is earlier than Jan 1, 1990
    * or later than Jan 1, 2290, we consider this a bad key.  This helps
@@ -2943,6 +2943,6 @@
    */
   if(unalloc
-     && (ret_val->mtime.high < REGFI_MTIME_MIN_HIGH 
-	 || ret_val->mtime.high > REGFI_MTIME_MAX_HIGH))
+     && (ret_val->mtime < REGFI_MTIME_MIN
+	 || ret_val->mtime > REGFI_MTIME_MAX))
   { goto fail_locked; }
 
@@ -3794,31 +3794,19 @@
 
 /****************************************************************************
- Put a 8 byte filetime from a time_t
+ Returns an 8 byte filetime from a time_t
  This takes real GMT as input and converts to kludge-GMT
 ****************************************************************************/
-void regfi_unix2nt_time(REGFI_NTTIME *nt, time_t t)
+REGFI_NTTIME regfi_unix2nt_time(time_t t)
 {
   double d;
-  
-  if (t==0) 
-  {
-    nt->low = 0;
-    nt->high = 0;
-    return;
-  }
+
+  if (t==0)
+    return 0L;
   
   if (t == TIME_T_MAX) 
-  {
-    nt->low = 0xffffffff;
-    nt->high = 0x7fffffff;
-    return;
-  }		
+    return 0x7fffffffffffffffL;
   
   if (t == -1) 
-  {
-    nt->low = 0xffffffff;
-    nt->high = 0xffffffff;
-    return;
-  }		
+    return 0xffffffffffffffffL;
   
   /* this converts GMT to kludge-GMT */
@@ -3829,10 +3817,12 @@
   /* t -= TimeDiff(t) - get_serverzone(); */
   
-  d = (double)(t);
-  d += TIME_FIXUP_CONSTANT;
+  d = (double)(t) + REGFI_TIME_FIXUP;
   d *= 1.0e7;
-  
-  nt->high = (uint32_t)(d * (1.0/(4.0*(double)(1<<30))));
-  nt->low  = (uint32_t)(d - ((double)nt->high)*4.0*(double)(1<<30));
+  /*
+  nt->high = (uint32_t)(d * (1.0/c));
+  nt->low  = (uint32_t)(d - ((double)nt->high) * c);
+  */
+
+  return (REGFI_NTTIME) d;
 }
 
@@ -3849,29 +3839,15 @@
  converts this to real GMT.
 ****************************************************************************/
-double regfi_nt2unix_time(const REGFI_NTTIME* nt)
+double regfi_nt2unix_time(REGFI_NTTIME nt)
 {
   double ret_val;
-
-  /* The next two lines are a fix needed for the 
-     broken SCO compiler. JRA. */
-  time_t l_time_min = TIME_T_MIN;
-  time_t l_time_max = TIME_T_MAX;
-  
-  if (nt->high == 0 || (nt->high == 0xffffffff && nt->low == 0xffffffff))
-    return(0);
-  
-  ret_val = ((double)nt->high)*4.0*(double)(1<<30);
-  ret_val += nt->low;
-  ret_val *= 1.0e-7;
+  
+  if (nt == 0 || nt == 0xffffffffffffffffL)
+    return 0;
+  
+  ret_val = (double)(nt) * 1.0e-7;
   
   /* now adjust by 369 years to make the secs since 1970 */
-  ret_val -= TIME_FIXUP_CONSTANT;
-  
-  /* XXX: should these sanity checks be removed? */
-  if (ret_val <= l_time_min)
-    return (l_time_min);
-  
-  if (ret_val >= l_time_max)
-    return (l_time_max);
+  ret_val -= REGFI_TIME_FIXUP;
   
   /* this takes us from kludge-GMT to real GMT */
Index: /trunk/src/common.c
===================================================================
--- /trunk/src/common.c	(revision 250)
+++ /trunk/src/common.c	(revision 251)
@@ -361,5 +361,5 @@
 
 
-void formatTime(const REGFI_NTTIME* nttime, char* output)
+void formatTime(REGFI_NTTIME nttime, char* output)
 {
   time_t tmp_time[1];
Index: /trunk/src/reglookup-recover.c
===================================================================
--- /trunk/src/reglookup-recover.c	(revision 250)
+++ /trunk/src/reglookup-recover.c	(revision 251)
@@ -73,5 +73,5 @@
   char* quoted_raw = "";
 
-  formatTime(&nk->mtime, mtime);
+  formatTime(nk->mtime, mtime);
   
   /* XXX: Add command line option to choose output encoding */
Index: /trunk/src/reglookup.c
===================================================================
--- /trunk/src/reglookup.c	(revision 250)
+++ /trunk/src/reglookup.c	(revision 251)
@@ -107,5 +107,5 @@
   {
     cur_key = regfi_iterator_cur_key(iter);
-    *tmp_time = regfi_nt2unix_time(&cur_key->mtime);
+    *tmp_time = regfi_nt2unix_time(cur_key->mtime);
     tmp_time_s = gmtime(tmp_time);
     strftime(mtime, sizeof(mtime), "%Y-%m-%d %H:%M:%S", tmp_time_s);
@@ -304,5 +304,5 @@
   const REGFI_CLASSNAME* classname;
 
-  formatTime(&key->mtime, mtime);
+  formatTime(key->mtime, mtime);
 
   if(print_security && (sk=regfi_fetch_sk(iter->f, key)))
