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:
17 #include <sys/times.h>
20 DEFAULT_DEBUG_CHANNEL(crtdll);
23 /* INTERNAL: Return formatted current time/date */
24 static LPSTR __CRTDLL__get_current_time(LPSTR out, const char * format);
25 static LPSTR __CRTDLL__get_current_time(LPSTR out, const char * format)
30 if ((time(&t) != ((time_t)-1)) &&
31 ((_tm = localtime(&t)) != 0) &&
32 (strftime(out,9,format,_tm) == 8))
42 /*********************************************************************
47 VOID __cdecl CRTDLL__ftime (struct _timeb* t)
49 t->time = CRTDLL_time(NULL);
50 t->millitm = 0; /* FIXME */
56 /**********************************************************************
57 * _strdate (CRTDLL.283)
59 * Return the current date as MM/DD/YY - (American Format)
61 LPSTR __cdecl CRTDLL__strdate (LPSTR date)
63 return __CRTDLL__get_current_time(date,"%m/%d/%y");
67 /*********************************************************************
68 * _strtime (CRTDLL.299)
70 * Return the current time as HH:MM:SS
72 LPSTR __cdecl CRTDLL__strtime (LPSTR date)
74 return __CRTDLL__get_current_time(date,"%H:%M:%S");
78 /*********************************************************************
81 clock_t __cdecl CRTDLL_clock(void)
87 res = alltimes.tms_utime + alltimes.tms_stime+
88 alltimes.tms_cutime + alltimes.tms_cstime;
89 /* Fixme: We need some symbolic representation
90 for (Hostsystem_)CLOCKS_PER_SEC
91 and (Emulated_system_)CLOCKS_PER_SEC
92 10 holds only for Windows/Linux_i86)
98 /*********************************************************************
99 * difftime (CRTDLL.357)
101 double __cdecl CRTDLL_difftime (time_t time1, time_t time2)
105 timediff = (double)(time1 - time2);
110 /*********************************************************************
113 time_t __cdecl CRTDLL_time(time_t *timeptr)
115 time_t curtime = time(NULL);