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:
15 #include <sys/times.h>
18 DEFAULT_DEBUG_CHANNEL(crtdll);
21 /* INTERNAL: Return formatted current time/date */
22 static LPSTR __CRTDLL__get_current_time(LPSTR out, const char * format);
23 static LPSTR __CRTDLL__get_current_time(LPSTR out, const char * format)
28 if ((time(&t) != ((time_t)-1)) &&
29 ((_tm = localtime(&t)) != 0) &&
30 (strftime(out,9,format,_tm) == 8))
40 /*********************************************************************
45 VOID __cdecl CRTDLL__ftime (struct _timeb* t)
47 t->time = CRTDLL_time(NULL);
48 t->millitm = 0; /* FIXME */
54 /**********************************************************************
55 * _strdate (CRTDLL.283)
57 * Return the current date as MM/DD/YY - (American Format)
59 LPSTR __cdecl CRTDLL__strdate (LPSTR date)
61 return __CRTDLL__get_current_time(date,"%m/%d/%y");
65 /*********************************************************************
66 * _strtime (CRTDLL.299)
68 * Return the current time as HH:MM:SS
70 LPSTR __cdecl CRTDLL__strtime (LPSTR date)
72 return __CRTDLL__get_current_time(date,"%H:%M:%S");
76 /*********************************************************************
79 clock_t __cdecl CRTDLL_clock(void)
85 res = alltimes.tms_utime + alltimes.tms_stime+
86 alltimes.tms_cutime + alltimes.tms_cstime;
87 /* FIXME: We need some symbolic representation
88 for (Hostsystem_)CLOCKS_PER_SEC
89 and (Emulated_system_)CLOCKS_PER_SEC
90 10 holds only for Windows/Linux_i86)
96 /*********************************************************************
97 * difftime (CRTDLL.357)
99 double __cdecl CRTDLL_difftime (time_t time1, time_t time2)
103 timediff = (double)(time1 - time2);
108 /*********************************************************************
111 time_t __cdecl CRTDLL_time(time_t *timeptr)
113 time_t curtime = time(NULL);