Convert some invalid offsets in GetWindowLong16 into valid offsets.
[wine/multimedia.git] / win32 / time.c
bloba0ca47abf490390671a9d2b90e08da4161a7a99a
1 /*
2 * Win32 kernel functions
4 * Copyright 1995 Martin von Loewis and Cameron Heide
5 */
7 #include <string.h>
8 #include <time.h>
9 #include <sys/time.h>
10 #include <unistd.h>
11 #include "file.h"
12 #include "winerror.h"
13 #include "debugtools.h"
15 DEFAULT_DEBUG_CHANNEL(win32);
17 /***********************************************************************
18 * GetLocalTime (KERNEL32.@)
20 VOID WINAPI GetLocalTime(LPSYSTEMTIME systime)
22 time_t local_time;
23 struct tm *local_tm;
24 struct timeval tv;
26 gettimeofday(&tv, NULL);
27 local_time = tv.tv_sec;
28 local_tm = localtime(&local_time);
30 systime->wYear = local_tm->tm_year + 1900;
31 systime->wMonth = local_tm->tm_mon + 1;
32 systime->wDayOfWeek = local_tm->tm_wday;
33 systime->wDay = local_tm->tm_mday;
34 systime->wHour = local_tm->tm_hour;
35 systime->wMinute = local_tm->tm_min;
36 systime->wSecond = local_tm->tm_sec;
37 systime->wMilliseconds = (tv.tv_usec / 1000) % 1000;
40 /***********************************************************************
41 * GetSystemTime (KERNEL32.@)
43 VOID WINAPI GetSystemTime(LPSYSTEMTIME systime)
45 time_t system_time;
46 struct tm *system_tm;
47 struct timeval tv;
49 gettimeofday(&tv, NULL);
50 system_time = tv.tv_sec;
51 system_tm = gmtime(&system_time);
53 systime->wYear = system_tm->tm_year + 1900;
54 systime->wMonth = system_tm->tm_mon + 1;
55 systime->wDayOfWeek = system_tm->tm_wday;
56 systime->wDay = system_tm->tm_mday;
57 systime->wHour = system_tm->tm_hour;
58 systime->wMinute = system_tm->tm_min;
59 systime->wSecond = system_tm->tm_sec;
60 systime->wMilliseconds = (tv.tv_usec / 1000) % 1000;