2 * CRTDLL 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
9 * Implementation Notes:
16 #include <sys/times.h>
19 DEFAULT_DEBUG_CHANNEL(crtdll);
22 /* INTERNAL: Return formatted current time/date */
23 static LPSTR __CRTDLL__get_current_time(LPSTR out, const char * format);
24 static LPSTR __CRTDLL__get_current_time(LPSTR out, const char * format)
29 if ((time(&t) != ((time_t)-1)) &&
30 ((_tm = localtime(&t)) != 0) &&
31 (strftime(out,9,format,_tm) == 8))
41 /*********************************************************************
46 VOID __cdecl CRTDLL__ftime (struct _timeb* t)
48 t->time = CRTDLL_time(NULL);
49 t->millitm = 0; /* FIXME */
55 /**********************************************************************
56 * _strdate (CRTDLL.283)
58 * Return the current date as MM/DD/YY - (American Format)
60 LPSTR __cdecl CRTDLL__strdate (LPSTR date)
62 return __CRTDLL__get_current_time(date,"%m/%d/%y");
66 /*********************************************************************
67 * _strtime (CRTDLL.299)
69 * Return the current time as HH:MM:SS
71 LPSTR __cdecl CRTDLL__strtime (LPSTR date)
73 return __CRTDLL__get_current_time(date,"%H:%M:%S");
77 /*********************************************************************
80 clock_t __cdecl CRTDLL_clock(void)
86 res = alltimes.tms_utime + alltimes.tms_stime+
87 alltimes.tms_cutime + alltimes.tms_cstime;
88 /* Fixme: We need some symbolic representation
89 for (Hostsystem_)CLOCKS_PER_SEC
90 and (Emulated_system_)CLOCKS_PER_SEC
91 10 holds only for Windows/Linux_i86)
97 /*********************************************************************
98 * difftime (CRTDLL.357)
100 double __cdecl CRTDLL_difftime (time_t time1, time_t time2)
104 timediff = (double)(time1 - time2);
109 /*********************************************************************
112 time_t __cdecl CRTDLL_time(time_t *timeptr)
114 time_t curtime = time(NULL);