2 * Win32 kernel functions
4 * Copyright 1995 Martin von Loewis and Cameron Heide
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "wine/port.h"
26 #ifdef HAVE_SYS_TIME_H
27 # include <sys/time.h>
34 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(win32
);
38 /***********************************************************************
39 * GetLocalTime (KERNEL32.@)
41 VOID WINAPI
GetLocalTime(LPSYSTEMTIME systime
)
47 gettimeofday(&tv
, NULL
);
48 local_time
= tv
.tv_sec
;
49 local_tm
= localtime(&local_time
);
51 systime
->wYear
= local_tm
->tm_year
+ 1900;
52 systime
->wMonth
= local_tm
->tm_mon
+ 1;
53 systime
->wDayOfWeek
= local_tm
->tm_wday
;
54 systime
->wDay
= local_tm
->tm_mday
;
55 systime
->wHour
= local_tm
->tm_hour
;
56 systime
->wMinute
= local_tm
->tm_min
;
57 systime
->wSecond
= local_tm
->tm_sec
;
58 systime
->wMilliseconds
= (tv
.tv_usec
/ 1000) % 1000;
61 /***********************************************************************
62 * GetSystemTime (KERNEL32.@)
64 VOID WINAPI
GetSystemTime(LPSYSTEMTIME systime
)
70 gettimeofday(&tv
, NULL
);
71 system_time
= tv
.tv_sec
;
72 system_tm
= gmtime(&system_time
);
74 systime
->wYear
= system_tm
->tm_year
+ 1900;
75 systime
->wMonth
= system_tm
->tm_mon
+ 1;
76 systime
->wDayOfWeek
= system_tm
->tm_wday
;
77 systime
->wDay
= system_tm
->tm_mday
;
78 systime
->wHour
= system_tm
->tm_hour
;
79 systime
->wMinute
= system_tm
->tm_min
;
80 systime
->wSecond
= system_tm
->tm_sec
;
81 systime
->wMilliseconds
= (tv
.tv_usec
/ 1000) % 1000;