2 * msvcrt.dll date/time functions
4 * Copyright 1996,1998 Marcus Meissner
5 * Copyright 1996 Jukka Iivonen
6 * Copyright 1997,2000 Uwe Bonnes
7 * Copyright 2000 Jon Griffiths
10 #include <sys/times.h>
13 DEFAULT_DEBUG_CHANNEL(msvcrt);
15 typedef struct __MSVCRT_timeb
18 unsigned short millitm;
24 /* INTERNAL: Return formatted current time/date */
25 char * MSVCRT_get_current_time(char * out, const char * format)
27 static const time_t bad_time = (time_t)-1;
29 struct tm *_tm = NULL;
32 if (time(&t) != bad_time && (_tm = localtime(&t)) &&
33 strftime(out,9,format,_tm) == 8)
40 /**********************************************************************
43 char * __cdecl MSVCRT__strdate (char * date)
45 return MSVCRT_get_current_time(date,"%m/%d/%y");
48 /*********************************************************************
51 char * __cdecl MSVCRT__strtime (char * date)
53 return MSVCRT_get_current_time(date,"%H:%M:%S");
56 /*********************************************************************
59 clock_t __cdecl MSVCRT_clock(void)
65 res = alltimes.tms_utime + alltimes.tms_stime +
66 alltimes.tms_cutime + alltimes.tms_cstime;
67 /* FIXME: We need some symbolic representation for CLOCKS_PER_SEC,
68 * 10 holds only for Windows/Linux_i86)
73 /*********************************************************************
76 double __cdecl MSVCRT_difftime (time_t time1, time_t time2)
78 return (double)(time1 - time2);
81 /*********************************************************************
84 time_t __cdecl MSVCRT_time(time_t *buf)
86 time_t curtime = time(NULL);
87 return buf ? *buf = curtime : curtime;
90 /*********************************************************************
93 void __cdecl MSVCRT__ftime (MSVCRT_timeb *buf)
95 buf->time = MSVCRT_time(NULL);
96 buf->millitm = 0; /* FIXME */