- Unicodeify control.
[wine/multimedia.git] / win32 / time.c
blob45798ec5a00ec5b01d0e13ea8410a080da6fadc5
1 /*
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
21 #include "config.h"
22 #include "wine/port.h"
24 #include <string.h>
25 #include <time.h>
26 #ifdef HAVE_SYS_TIME_H
27 # include <sys/time.h>
28 #endif
29 #ifdef HAVE_UNISTD_H
30 # include <unistd.h>
31 #endif
32 #include "file.h"
33 #include "winerror.h"
34 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(win32);
38 /***********************************************************************
39 * GetLocalTime (KERNEL32.@)
41 VOID WINAPI GetLocalTime(LPSYSTEMTIME systime)
43 time_t local_time;
44 struct tm *local_tm;
45 struct timeval tv;
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)
66 time_t system_time;
67 struct tm *system_tm;
68 struct timeval tv;
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;