Better 'Naming Convention' conformance.
3 #include <lemon/bits/mingw32_time.h>
9 static const char days[] =
10 "Sun Mon Tue Wed Thu Fri Sat ";
11 static const char months[] =
12 "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ";
14 void num2str(char *c,int i) {
19 char *asctime_r(const struct tm *t, char *buf) {
20 *(int*)buf=*(int*)(days+(t->tm_wday<<2));
21 *(int*)(buf+4)=*(int*)(months+(t->tm_mon<<2));
22 num2str(buf+8,t->tm_mday);
23 if (buf[8]=='0') buf[8]=' ';
25 num2str(buf+11,t->tm_hour);
27 num2str(buf+14,t->tm_min);
29 num2str(buf+17,t->tm_sec);
31 num2str(buf+20,(t->tm_year+1900)/100);
32 num2str(buf+22,(t->tm_year+1900)%100);
33 buf[24]='\n'; buf[25]='\0';
37 struct tm * localtime_r (const time_t *t, struct tm *tm) {
40 if ((tmp = localtime(t)) && tm)
48 char *ctime_r(const time_t * tim_p , char * result) {
50 return asctime_r (localtime_r (tim_p, &tm), result);
54 int gettimeofday(struct timeval * tp, struct timezone *) {
59 time_t theTime = time(NULL);
62 tmrec = *localtime(&theTime);
63 tp->tv_sec = mktime(&tmrec);
64 GetLocalTime(&systime); /* system time */
66 tp->tv_usec = systime.wMilliseconds * 1000;
71 long filetime_to_clock(FILETIME *ft)
73 __int64 qw = ft->dwHighDateTime;
75 qw |= ft->dwLowDateTime;
81 int times(struct tms *tmbuf)
83 FILETIME create, exit, kernel, user;
84 if (GetProcessTimes(GetCurrentProcess(),&create, &exit, &kernel, &user)) {
85 tmbuf->tms_utime = filetime_to_clock(&user);
86 tmbuf->tms_stime = filetime_to_clock(&kernel);
87 tmbuf->tms_cutime = 0;
88 tmbuf->tms_cstime = 0;
91 tmbuf->tms_utime = clock();
93 tmbuf->tms_cutime = 0;
94 tmbuf->tms_cstime = 0;