updated the 3.0 branch from the head branch - ready for alpha18
[kai/samba.git] / source3 / lib / time.c
1 /* 
2    Unix SMB/CIFS implementation.
3    time handling functions
4    Copyright (C) Andrew Tridgell 1992-1998
5    
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10    
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15    
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21 #include "includes.h"
22
23 /*
24   This stuff was largely rewritten by Paul Eggert <eggert@twinsun.com>
25   in May 1996 
26   */
27
28
29 int extra_time_offset = 0;
30
31 #ifndef CHAR_BIT
32 #define CHAR_BIT 8
33 #endif
34
35 #ifndef TIME_T_MIN
36 #define TIME_T_MIN ((time_t)0 < (time_t) -1 ? (time_t) 0 \
37                     : ~ (time_t) 0 << (sizeof (time_t) * CHAR_BIT - 1))
38 #endif
39 #ifndef TIME_T_MAX
40 #define TIME_T_MAX (~ (time_t) 0 - TIME_T_MIN)
41 #endif
42
43 /*******************************************************************
44  External access to time_t_min and time_t_max.
45 ********************************************************************/
46
47 time_t get_time_t_max(void)
48 {
49         return TIME_T_MAX;
50 }
51
52 /*******************************************************************
53 a gettimeofday wrapper
54 ********************************************************************/
55 void GetTimeOfDay(struct timeval *tval)
56 {
57 #ifdef HAVE_GETTIMEOFDAY_TZ
58         gettimeofday(tval,NULL);
59 #else
60         gettimeofday(tval);
61 #endif
62 }
63
64 #define TM_YEAR_BASE 1900
65
66 /*******************************************************************
67 yield the difference between *A and *B, in seconds, ignoring leap seconds
68 ********************************************************************/
69 static int tm_diff(struct tm *a, struct tm *b)
70 {
71   int ay = a->tm_year + (TM_YEAR_BASE - 1);
72   int by = b->tm_year + (TM_YEAR_BASE - 1);
73   int intervening_leap_days =
74     (ay/4 - by/4) - (ay/100 - by/100) + (ay/400 - by/400);
75   int years = ay - by;
76   int days = 365*years + intervening_leap_days + (a->tm_yday - b->tm_yday);
77   int hours = 24*days + (a->tm_hour - b->tm_hour);
78   int minutes = 60*hours + (a->tm_min - b->tm_min);
79   int seconds = 60*minutes + (a->tm_sec - b->tm_sec);
80
81   return seconds;
82 }
83
84 /*******************************************************************
85   return the UTC offset in seconds west of UTC, or 0 if it cannot be determined
86   ******************************************************************/
87 static int TimeZone(time_t t)
88 {
89   struct tm *tm = gmtime(&t);
90   struct tm tm_utc;
91   if (!tm)
92     return 0;
93   tm_utc = *tm;
94   tm = localtime(&t);
95   if (!tm)
96     return 0;
97   return tm_diff(&tm_utc,tm);
98
99 }
100
101 static BOOL done_serverzone_init;
102
103 /* Return the smb serverzone value */
104
105 static int get_serverzone(void)
106 {
107         static int serverzone;
108
109         if (!done_serverzone_init) {
110                 serverzone = TimeZone(time(NULL));
111
112                 if ((serverzone % 60) != 0) {
113                         DEBUG(1,("WARNING: Your timezone is not a multiple of 1 minute.\n"));
114                 }
115
116                 DEBUG(4,("Serverzone is %d\n",serverzone));
117
118                 done_serverzone_init = True;
119         }
120
121         return serverzone;
122 }
123
124 /* Re-read the smb serverzone value */
125
126 static struct timeval start_time_hires;
127
128 void TimeInit(void)
129 {
130         done_serverzone_init = False;
131         get_serverzone();
132         /* Save the start time of this process. */
133         if (start_time_hires.tv_sec == 0 && start_time_hires.tv_usec == 0)
134                 GetTimeOfDay(&start_time_hires);
135 }
136
137 /**********************************************************************
138  Return a timeval struct of the uptime of this process. As TimeInit is
139  done before a daemon fork then this is the start time from the parent
140  daemon start. JRA.
141 ***********************************************************************/
142
143 void get_process_uptime(struct timeval *ret_time)
144 {
145         struct timeval time_now_hires;
146
147         GetTimeOfDay(&time_now_hires);
148         ret_time->tv_sec = time_now_hires.tv_sec - start_time_hires.tv_sec;
149         ret_time->tv_usec = time_now_hires.tv_usec - start_time_hires.tv_usec;
150         if (time_now_hires.tv_usec < start_time_hires.tv_usec) {
151                 ret_time->tv_sec -= 1;
152                 ret_time->tv_usec = 1000000 + (time_now_hires.tv_usec - start_time_hires.tv_usec);
153         } else
154                 ret_time->tv_usec = time_now_hires.tv_usec - start_time_hires.tv_usec;
155 }
156
157 /*******************************************************************
158 return the same value as TimeZone, but it should be more efficient.
159
160 We keep a table of DST offsets to prevent calling localtime() on each 
161 call of this function. This saves a LOT of time on many unixes.
162
163 Updated by Paul Eggert <eggert@twinsun.com>
164 ********************************************************************/
165 static int TimeZoneFaster(time_t t)
166 {
167   static struct dst_table {time_t start,end; int zone;} *tdt, *dst_table = NULL;
168   static int table_size = 0;
169   int i;
170   int zone = 0;
171
172   if (t == 0) t = time(NULL);
173
174   /* Tunis has a 8 day DST region, we need to be careful ... */
175 #define MAX_DST_WIDTH (365*24*60*60)
176 #define MAX_DST_SKIP (7*24*60*60)
177
178   for (i=0;i<table_size;i++)
179     if (t >= dst_table[i].start && t <= dst_table[i].end) break;
180
181   if (i<table_size) {
182     zone = dst_table[i].zone;
183   } else {
184     time_t low,high;
185
186     zone = TimeZone(t);
187     tdt = (struct dst_table *)Realloc(dst_table,
188                                               sizeof(dst_table[0])*(i+1));
189     if (!tdt) {
190       DEBUG(0,("TimeZoneFaster: out of memory!\n"));
191       SAFE_FREE(dst_table);
192       table_size = 0;
193     } else {
194       dst_table = tdt;
195       table_size++;
196
197       dst_table[i].zone = zone; 
198       dst_table[i].start = dst_table[i].end = t;
199     
200       /* no entry will cover more than 6 months */
201       low = t - MAX_DST_WIDTH/2;
202       if (t < low)
203         low = TIME_T_MIN;
204       
205       high = t + MAX_DST_WIDTH/2;
206       if (high < t)
207         high = TIME_T_MAX;
208       
209       /* widen the new entry using two bisection searches */
210       while (low+60*60 < dst_table[i].start) {
211         if (dst_table[i].start - low > MAX_DST_SKIP*2)
212           t = dst_table[i].start - MAX_DST_SKIP;
213         else
214           t = low + (dst_table[i].start-low)/2;
215         if (TimeZone(t) == zone)
216           dst_table[i].start = t;
217         else
218           low = t;
219       }
220
221       while (high-60*60 > dst_table[i].end) {
222         if (high - dst_table[i].end > MAX_DST_SKIP*2)
223           t = dst_table[i].end + MAX_DST_SKIP;
224         else
225           t = high - (high-dst_table[i].end)/2;
226         if (TimeZone(t) == zone)
227           dst_table[i].end = t;
228         else
229           high = t;
230       }
231 #if 0
232       DEBUG(1,("Added DST entry from %s ",
233                asctime(localtime(&dst_table[i].start))));
234       DEBUG(1,("to %s (%d)\n",asctime(localtime(&dst_table[i].end)),
235                dst_table[i].zone));
236 #endif
237     }
238   }
239   return zone;
240 }
241
242 /****************************************************************************
243   return the UTC offset in seconds west of UTC, adjusted for extra time offset
244   **************************************************************************/
245 int TimeDiff(time_t t)
246 {
247   return TimeZoneFaster(t) + 60*extra_time_offset;
248 }
249
250
251 /****************************************************************************
252   return the UTC offset in seconds west of UTC, adjusted for extra time
253   offset, for a local time value.  If ut = lt + LocTimeDiff(lt), then
254   lt = ut - TimeDiff(ut), but the converse does not necessarily hold near
255   daylight savings transitions because some local times are ambiguous.
256   LocTimeDiff(t) equals TimeDiff(t) except near daylight savings transitions.
257   +**************************************************************************/
258 static int LocTimeDiff(time_t lte)
259 {
260   time_t lt = lte - 60*extra_time_offset;
261   int d = TimeZoneFaster(lt);
262   time_t t = lt + d;
263
264   /* if overflow occurred, ignore all the adjustments so far */
265   if (((lte < lt) ^ (extra_time_offset < 0))  |  ((t < lt) ^ (d < 0)))
266     t = lte;
267
268   /* now t should be close enough to the true UTC to yield the right answer */
269   return TimeDiff(t);
270 }
271
272
273 /****************************************************************************
274 try to optimise the localtime call, it can be quite expensive on some machines
275 ****************************************************************************/
276 struct tm *LocalTime(time_t *t)
277 {
278   time_t t2 = *t;
279
280   t2 -= TimeDiff(t2);
281
282   return(gmtime(&t2));
283 }
284
285 #define TIME_FIXUP_CONSTANT (369.0*365.25*24*60*60-(3.0*24*60*60+6.0*60*60))
286
287 /****************************************************************************
288 interpret an 8 byte "filetime" structure to a time_t
289 It's originally in "100ns units since jan 1st 1601"
290
291 It appears to be kludge-GMT (at least for file listings). This means
292 its the GMT you get by taking a localtime and adding the
293 serverzone. This is NOT the same as GMT in some cases. This routine
294 converts this to real GMT.
295 ****************************************************************************/
296 time_t nt_time_to_unix(NTTIME *nt)
297 {
298   double d;
299   time_t ret;
300   /* The next two lines are a fix needed for the 
301      broken SCO compiler. JRA. */
302   time_t l_time_min = TIME_T_MIN;
303   time_t l_time_max = TIME_T_MAX;
304
305   if (nt->high == 0) return(0);
306
307   d = ((double)nt->high)*4.0*(double)(1<<30);
308   d += (nt->low&0xFFF00000);
309   d *= 1.0e-7;
310  
311   /* now adjust by 369 years to make the secs since 1970 */
312   d -= TIME_FIXUP_CONSTANT;
313
314   if (!(l_time_min <= d && d <= l_time_max))
315     return(0);
316
317   ret = (time_t)(d+0.5);
318
319   /* this takes us from kludge-GMT to real GMT */
320   ret -= get_serverzone();
321   ret += LocTimeDiff(ret);
322
323   return(ret);
324 }
325
326 /****************************************************************************
327 convert a NTTIME structure to a time_t
328 It's originally in "100ns units"
329
330 this is an absolute version of the one above.
331 By absolute I mean, it doesn't adjust from 1/1/1601 to 1/1/1970
332 if the NTTIME was 5 seconds, the time_t is 5 seconds. JFM
333 ****************************************************************************/
334 time_t nt_time_to_unix_abs(NTTIME *nt)
335 {
336         double d;
337         time_t ret;
338         /* The next two lines are a fix needed for the 
339            broken SCO compiler. JRA. */
340         time_t l_time_min = TIME_T_MIN;
341         time_t l_time_max = TIME_T_MAX;
342
343         if (nt->high == 0)
344                 return(0);
345
346         if (nt->high==0x80000000 && nt->low==0)
347                 return -1;
348
349         /* reverse the time */
350         /* it's a negative value, turn it to positive */
351         nt->high=~nt->high;
352         nt->low=~nt->low;
353
354         d = ((double)nt->high)*4.0*(double)(1<<30);
355         d += (nt->low&0xFFF00000);
356         d *= 1.0e-7;
357   
358         if (!(l_time_min <= d && d <= l_time_max))
359                 return(0);
360
361         ret = (time_t)(d+0.5);
362
363         /* this takes us from kludge-GMT to real GMT */
364         ret -= get_serverzone();
365         ret += LocTimeDiff(ret);
366
367         return(ret);
368 }
369
370
371
372 /****************************************************************************
373 interprets an nt time into a unix time_t
374 ****************************************************************************/
375 time_t interpret_long_date(char *p)
376 {
377         NTTIME nt;
378         nt.low = IVAL(p,0);
379         nt.high = IVAL(p,4);
380         return nt_time_to_unix(&nt);
381 }
382
383 /****************************************************************************
384 put a 8 byte filetime from a time_t
385 This takes real GMT as input and converts to kludge-GMT
386 ****************************************************************************/
387 void unix_to_nt_time(NTTIME *nt, time_t t)
388 {
389         double d;
390
391         if (t==0)
392         {
393                 nt->low = 0;
394                 nt->high = 0;
395                 return;
396         }
397         if (t == TIME_T_MAX)
398         {
399                 nt->low = 0xffffffff;
400                 nt->high = 0x7fffffff;
401                 return;
402         }               
403         if (t == -1)
404         {
405                 nt->low = 0xffffffff;
406                 nt->high = 0xffffffff;
407                 return;
408         }               
409
410         /* this converts GMT to kludge-GMT */
411         t -= TimeDiff(t) - get_serverzone(); 
412
413         d = (double)(t);
414         d += TIME_FIXUP_CONSTANT;
415         d *= 1.0e7;
416
417         nt->high = (uint32)(d * (1.0/(4.0*(double)(1<<30))));
418         nt->low  = (uint32)(d - ((double)nt->high)*4.0*(double)(1<<30));
419 }
420
421 /****************************************************************************
422 convert a time_t to a NTTIME structure
423
424 this is an absolute version of the one above.
425 By absolute I mean, it doesn't adjust from 1/1/1970 to 1/1/1601
426 if the nttime_t was 5 seconds, the NTTIME is 5 seconds. JFM
427 ****************************************************************************/
428 void unix_to_nt_time_abs(NTTIME *nt, time_t t)
429 {
430         double d;
431
432         if (t==0) {
433                 nt->low = 0;
434                 nt->high = 0;
435                 return;
436         }
437
438         if (t == TIME_T_MAX) {
439                 nt->low = 0xffffffff;
440                 nt->high = 0x7fffffff;
441                 return;
442         }
443                 
444         if (t == -1) {
445                 /* that's what NT uses for infinite */
446                 nt->low = 0x0;
447                 nt->high = 0x80000000;
448                 return;
449         }               
450
451         /* this converts GMT to kludge-GMT */
452         t -= LocTimeDiff(t) - get_serverzone(); 
453
454         d = (double)(t);
455         d *= 1.0e7;
456
457         nt->high = (uint32)(d * (1.0/(4.0*(double)(1<<30))));
458         nt->low  = (uint32)(d - ((double)nt->high)*4.0*(double)(1<<30));
459
460         /* convert to a negative value */
461         nt->high=~nt->high;
462         nt->low=~nt->low;
463 }
464
465
466 /****************************************************************************
467 take an NTTIME structure, containing high / low time.  convert to unix time.
468 lkclXXXX this may need 2 SIVALs not a memcpy.  we'll see...
469 ****************************************************************************/
470 void put_long_date(char *p,time_t t)
471 {
472         NTTIME nt;
473         unix_to_nt_time(&nt, t);
474         SIVAL(p, 0, nt.low);
475         SIVAL(p, 4, nt.high);
476 }
477
478 /****************************************************************************
479 check if it's a null mtime
480 ****************************************************************************/
481 BOOL null_mtime(time_t mtime)
482 {
483   if (mtime == 0 || mtime == 0xFFFFFFFF || mtime == (time_t)-1)
484     return(True);
485   return(False);
486 }
487
488 /*******************************************************************
489   create a 16 bit dos packed date
490 ********************************************************************/
491 static uint16 make_dos_date1(struct tm *t)
492 {
493   uint16 ret=0;
494   ret = (((unsigned)(t->tm_mon+1)) >> 3) | ((t->tm_year-80) << 1);
495   ret = ((ret&0xFF)<<8) | (t->tm_mday | (((t->tm_mon+1) & 0x7) << 5));
496   return(ret);
497 }
498
499 /*******************************************************************
500   create a 16 bit dos packed time
501 ********************************************************************/
502 static uint16 make_dos_time1(struct tm *t)
503 {
504   uint16 ret=0;
505   ret = ((((unsigned)t->tm_min >> 3)&0x7) | (((unsigned)t->tm_hour) << 3));
506   ret = ((ret&0xFF)<<8) | ((t->tm_sec/2) | ((t->tm_min & 0x7) << 5));
507   return(ret);
508 }
509
510 /*******************************************************************
511   create a 32 bit dos packed date/time from some parameters
512   This takes a GMT time and returns a packed localtime structure
513 ********************************************************************/
514 static uint32 make_dos_date(time_t unixdate)
515 {
516   struct tm *t;
517   uint32 ret=0;
518
519   t = LocalTime(&unixdate);
520   if (!t)
521     return 0xFFFFFFFF;
522
523   ret = make_dos_date1(t);
524   ret = ((ret&0xFFFF)<<16) | make_dos_time1(t);
525
526   return(ret);
527 }
528
529 /*******************************************************************
530 put a dos date into a buffer (time/date format)
531 This takes GMT time and puts local time in the buffer
532 ********************************************************************/
533 void put_dos_date(char *buf,int offset,time_t unixdate)
534 {
535   uint32 x = make_dos_date(unixdate);
536   SIVAL(buf,offset,x);
537 }
538
539 /*******************************************************************
540 put a dos date into a buffer (date/time format)
541 This takes GMT time and puts local time in the buffer
542 ********************************************************************/
543 void put_dos_date2(char *buf,int offset,time_t unixdate)
544 {
545   uint32 x = make_dos_date(unixdate);
546   x = ((x&0xFFFF)<<16) | ((x&0xFFFF0000)>>16);
547   SIVAL(buf,offset,x);
548 }
549
550 /*******************************************************************
551 put a dos 32 bit "unix like" date into a buffer. This routine takes
552 GMT and converts it to LOCAL time before putting it (most SMBs assume
553 localtime for this sort of date)
554 ********************************************************************/
555 void put_dos_date3(char *buf,int offset,time_t unixdate)
556 {
557   if (!null_mtime(unixdate))
558     unixdate -= TimeDiff(unixdate);
559   SIVAL(buf,offset,unixdate);
560 }
561
562 /*******************************************************************
563   interpret a 32 bit dos packed date/time to some parameters
564 ********************************************************************/
565 static void interpret_dos_date(uint32 date,int *year,int *month,int *day,int *hour,int *minute,int *second)
566 {
567   uint32 p0,p1,p2,p3;
568
569   p0=date&0xFF; p1=((date&0xFF00)>>8)&0xFF; 
570   p2=((date&0xFF0000)>>16)&0xFF; p3=((date&0xFF000000)>>24)&0xFF;
571
572   *second = 2*(p0 & 0x1F);
573   *minute = ((p0>>5)&0xFF) + ((p1&0x7)<<3);
574   *hour = (p1>>3)&0xFF;
575   *day = (p2&0x1F);
576   *month = ((p2>>5)&0xFF) + ((p3&0x1)<<3) - 1;
577   *year = ((p3>>1)&0xFF) + 80;
578 }
579
580 /*******************************************************************
581   create a unix date (int GMT) from a dos date (which is actually in
582   localtime)
583 ********************************************************************/
584 time_t make_unix_date(void *date_ptr)
585 {
586   uint32 dos_date=0;
587   struct tm t;
588   time_t ret;
589
590   dos_date = IVAL(date_ptr,0);
591
592   if (dos_date == 0) return(0);
593   
594   interpret_dos_date(dos_date,&t.tm_year,&t.tm_mon,
595                      &t.tm_mday,&t.tm_hour,&t.tm_min,&t.tm_sec);
596   t.tm_isdst = -1;
597   
598   /* mktime() also does the local to GMT time conversion for us */
599   ret = mktime(&t);
600
601   return(ret);
602 }
603
604 /*******************************************************************
605 like make_unix_date() but the words are reversed
606 ********************************************************************/
607 time_t make_unix_date2(void *date_ptr)
608 {
609   uint32 x,x2;
610
611   x = IVAL(date_ptr,0);
612   x2 = ((x&0xFFFF)<<16) | ((x&0xFFFF0000)>>16);
613   SIVAL(&x,0,x2);
614
615   return(make_unix_date((void *)&x));
616 }
617
618 /*******************************************************************
619   create a unix GMT date from a dos date in 32 bit "unix like" format
620   these generally arrive as localtimes, with corresponding DST
621   ******************************************************************/
622 time_t make_unix_date3(void *date_ptr)
623 {
624   time_t t = (time_t)IVAL(date_ptr,0);
625   if (!null_mtime(t))
626     t += LocTimeDiff(t);
627   return(t);
628 }
629
630
631 /***************************************************************************
632 return a HTTP/1.0 time string
633   ***************************************************************************/
634 char *http_timestring(time_t t)
635 {
636   static fstring buf;
637   struct tm *tm = LocalTime(&t);
638
639   if (!tm)
640     slprintf(buf,sizeof(buf)-1,"%ld seconds since the Epoch",(long)t);
641   else
642 #ifndef HAVE_STRFTIME
643   fstrcpy(buf, asctime(tm));
644   if(buf[strlen(buf)-1] == '\n')
645     buf[strlen(buf)-1] = 0;
646 #else /* !HAVE_STRFTIME */
647   strftime(buf, sizeof(buf)-1, "%a, %d %b %Y %H:%M:%S %Z", tm);
648 #endif /* !HAVE_STRFTIME */
649   return buf;
650 }
651
652
653
654 /****************************************************************************
655  Return the date and time as a string
656 ****************************************************************************/
657
658 char *timestring(BOOL hires)
659 {
660         static fstring TimeBuf;
661         struct timeval tp;
662         time_t t;
663         struct tm *tm;
664
665         if (hires) {
666                 GetTimeOfDay(&tp);
667                 t = (time_t)tp.tv_sec;
668         } else {
669                 t = time(NULL);
670         }
671         tm = LocalTime(&t);
672         if (!tm) {
673                 if (hires) {
674                         slprintf(TimeBuf,
675                                  sizeof(TimeBuf)-1,
676                                  "%ld.%06ld seconds since the Epoch",
677                                  (long)tp.tv_sec, 
678                                  (long)tp.tv_usec);
679                 } else {
680                         slprintf(TimeBuf,
681                                  sizeof(TimeBuf)-1,
682                                  "%ld seconds since the Epoch",
683                                  (long)t);
684                 }
685         } else {
686 #ifdef HAVE_STRFTIME
687                 if (hires) {
688                         strftime(TimeBuf,sizeof(TimeBuf)-1,"%Y/%m/%d %H:%M:%S",tm);
689                         slprintf(TimeBuf+strlen(TimeBuf),
690                                  sizeof(TimeBuf)-1 - strlen(TimeBuf), 
691                                  ".%06ld", 
692                                  (long)tp.tv_usec);
693                 } else {
694                         strftime(TimeBuf,100,"%Y/%m/%d %H:%M:%S",tm);
695                 }
696 #else
697                 if (hires) {
698                         slprintf(TimeBuf, 
699                                  sizeof(TimeBuf)-1, 
700                                  "%s.%06ld", 
701                                  asctime(tm), 
702                                  (long)tp.tv_usec);
703                 } else {
704                         fstrcpy(TimeBuf, asctime(tm));
705                 }
706 #endif
707         }
708         return(TimeBuf);
709 }
710
711 /****************************************************************************
712   return the best approximation to a 'create time' under UNIX from a stat
713   structure.
714 ****************************************************************************/
715
716 time_t get_create_time(SMB_STRUCT_STAT *st,BOOL fake_dirs)
717 {
718   time_t ret, ret1;
719
720   if(S_ISDIR(st->st_mode) && fake_dirs)
721     return (time_t)315493200L;          /* 1/1/1980 */
722     
723   ret = MIN(st->st_ctime, st->st_mtime);
724   ret1 = MIN(ret, st->st_atime);
725
726   if(ret1 != (time_t)0)
727     return ret1;
728
729   /*
730    * One of ctime, mtime or atime was zero (probably atime).
731    * Just return MIN(ctime, mtime).
732    */
733   return ret;
734 }
735
736 /****************************************************************************
737 initialise an NTTIME to -1, which means "unknown" or "don't expire"
738 ****************************************************************************/
739
740 void init_nt_time(NTTIME *nt)
741 {
742         nt->high = 0x7FFFFFFF;
743         nt->low = 0xFFFFFFFF;
744 }