- Made sure that the files that contains the declarations
[wine] / dlls / kernel / time.c
1 /*
2  * Win32 kernel functions
3  *
4  * Copyright 1995 Martin von Loewis and Cameron Heide
5  */
6
7 #include <string.h>
8 #include <unistd.h>
9 #include <stdlib.h>
10 #include <sys/time.h>
11 #include <sys/times.h>
12 #include "file.h"
13 #include "ntddk.h"
14 #include "winerror.h"
15 #include "winnls.h"
16 #include "wine/unicode.h"
17 #include "debugtools.h"
18
19 DEFAULT_DEBUG_CHANNEL(win32);
20
21 /* maximum time adjustment in seconds for SetLocalTime and SetSystemTime */
22 #define SETTIME_MAX_ADJUST 120
23
24
25 /* This structure is used to store strings that represent all of the time zones
26    in the world. (This is used to help GetTimeZoneInformation)
27 */
28 struct tagTZ_INFO
29 {
30     const char *psTZFromUnix;
31     WCHAR psTZWindows[32];
32     int bias;
33     int dst;
34 };
35
36 static const struct tagTZ_INFO TZ_INFO[] =
37 {
38    {"MHT", 
39     {'D','a','t','e','l','i','n','e',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
40     -720, 0},
41    {"SST", 
42     {'S','a','m','o','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
43     660, 0},
44    {"HST",
45     {'H','a','w','a','i','i','a','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
46     600, 0},
47    {"AKDT", 
48     {'A','l','a','s','k','a','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
49     480, 1},
50    {"PDT", 
51     {'P','a','c','i','f','i','c',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
52     420, 1},
53    {"MST",
54     {'U','S',' ','M','o','u','n','t','a','i','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
55     420, 0},
56    {"MDT",
57     {'M','o','u','n','t','a','i','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
58     360, 1},
59    {"CST",
60     {'C','e','n','t','r','a','l',' ','A','m','e','r','i','c','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
61     360, 0},
62    {"CDT",
63     {'C','e','n','t','r','a','l',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
64     300, 1},
65    {"COT",
66     {'S','A',' ','P','a','c','i','f','i','c',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
67     300, 0},
68    {"EDT",
69     {'E','a','s','t','e','r','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
70      240, 1},
71    {"EST",
72     {'U','S',' ','E','a','s','t','e','r','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
73     300, 0},
74    {"ADT",
75     {'A','t','l','a','n','t','i','c',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
76     180, 1},
77    {"VET",
78     {'S','A',' ','W','e','s','t','e','r','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
79      240, 0},
80    {"CLT",
81     {'P','a','c','i','f','i','c',' ','S','A',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
82      240, 0},
83    {"NDT",
84     {'N','e','w','f','o','u','n','d','l','a','n','d',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
85     150, 1},
86    {"BRT",
87     {'E','.',' ','S','o','u','t','h',' ','A','m','e','r','i','c','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
88     180, 0},
89    {"ART",
90     {'S','A',' ','E','a','s','t','e','r','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
91     180, 0},
92    {"WGST",
93     {'G','r','e','e','n','l','a','n','d',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
94     120, 1},
95    {"GST",
96     {'M','i','d','-','A','t','l','a','n','t','i','c',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
97     120, 0},
98    {"AZOST",
99     {'A','z','o','r','e','s',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
100     0, 1},
101    {"CVT",
102     {'C','a','p','e',' ','V','e','r','d','e',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
103     60, 0},
104    {"WET",
105     {'G','r','e','e','n','w','i','c','h',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
106     0, 0},
107    {"BST",
108     {'G','M','T',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
109     -60, 1},
110    {"GMT",
111     {'G','M','T',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
112     0, 0},
113    {"CEST",
114     {'C','e','n','t','r','a','l',' ','E','u','r','o','p','e',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
115     -120, 1},
116    {"WAT",
117     {'W','.',' ','C','e','n','t','r','a','l',' ','A','f','r','i','c','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
118     -60, 0},
119    {"EEST",
120     {'E','.',' ','E','u','r','o','p','e',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
121     -180, 1},
122    {"EET",
123     {'E','g','y','p','t',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
124     -120, 0},
125    {"CAT",
126     {'S','o','u','t','h',' ','A','f','r','i','c','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
127     -120, 0},
128    {"IST",
129     {'I','s','r','a','e','l',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
130     -120, 0},
131    {"ADT",
132     {'A','r','a','b','i','c',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
133     -240, 1},
134    {"AST",
135     {'A','r','a','b',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
136     -180, 0},
137    {"MSD",
138     {'R','u','s','s','i','a','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
139     -240, 1},
140    {"EAT",
141     {'E','.',' ','A','f','r','i','c','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
142     -180, 0},
143    {"IRST",
144     {'I','r','a','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
145     -270, 1},
146    {"GST",
147     {'A','r','a','b','i','a','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
148     -240, 0},
149    {"AZST",
150     {'C','a','u','c','a','s','u','s',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
151     -300, 1},
152    {"AFT",
153     {'A','f','g','h','a','n','i','s','t','a','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
154     -270, 0},
155    {"YEKST",
156     {'E','k','a','t','e','r','i','n','b','u','r','g',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
157     -360, 1},
158    {"PKT",
159     {'W','e','s','t',' ','A','s','i','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
160     -300, 0},
161    {"IST",
162     {'I','n','d','i','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
163     -330, 0},
164    {"NPT",
165     {'N','e','p','a','l',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
166     -345, 0},
167    {"ALMST",
168     {'N','.',' ','C','e','n','t','r','a','l',' ','A','s','i','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
169     -420, 1},
170    {"BDT",
171     {'C','e','n','t','r','a','l',' ','A','s','i','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
172     -360, 0},
173    {"LKT",
174     {'S','r','i',' ','L','a','n','k','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
175     -360, 0},
176    {"MMT",
177     {'M','y','a','n','m','a','r',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
178     -390, 0},
179    {"ICT",
180     {'S','E',' ','A','s','i','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
181     -420, 0},
182    {"KRAST",
183     {'N','o','r','t','h',' ','A','s','i','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
184     -480, 1},
185    {"CST",
186     {'C','h','i','n','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
187     -480, 0},
188    {"IRKST",
189     {'N','o','r','t','h',' ','A','s','i','a',' ','E','a','s','t',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
190     -540, 1},
191    {"SGT",
192     {'M','a','l','a','y',' ','P','e','n','i','n','s','u','l','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
193     -480, 0},
194    {"WST",
195     {'W','.',' ','A','u','s','t','r','a','l','i','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
196     -480, 0},
197    {"JST",
198     {'T','o','k','y','o',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
199     -540, 0},
200    {"KST",
201     {'K','o','r','e','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
202     -540, 0},
203    {"YAKST",
204     {'Y','a','k','u','t','s','k',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
205     -600, 1},
206    {"CST",
207     {'C','e','n','.',' ','A','u','s','t','r','a','l','i','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
208     -570, 0},
209    {"EST",
210     {'E','.',' ','A','u','s','t','r','a','l','i','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
211     -600, 0},
212    {"GST",
213     {'W','e','s','t',' ','P','a','c','i','f','i','c',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
214     -600, 0},
215    {"VLAST",
216     {'V','l','a','d','i','v','o','s','t','o','k',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
217     -660, 1},
218    {"MAGST",
219     {'C','e','n','t','r','a','l',' ','P','a','c','i','f','i','c',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
220     -720, 1},
221    {"NZST",
222     {'N','e','w',' ','Z','e','a','l','a','n','d',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
223     -720, 0},
224    {"FJT",
225     {'F','i','j','i',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
226     -720, 0},
227    {"TOT",
228     {'T','o','n','g','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
229     -780, 0}
230 };
231
232 /* TIME_GetTZAsStr: helper function that returns the given timezone as a string.
233    This could be done with a hash table instead of merely iterating through
234    a table, however with the small amount of entries (60 or so) I didn't think
235    it was worth it. */
236 static const WCHAR* TIME_GetTZAsStr (time_t utc, int bias, int dst)
237 {
238    char psTZName[7];
239    struct tm *ptm = localtime(&utc);
240    int i;
241
242    if (!strftime (psTZName, 7, "%Z", ptm))
243       return (NULL);
244
245    for (i=0; i<(sizeof(TZ_INFO) / sizeof(struct tagTZ_INFO)); i++) 
246    {
247       if ( strcmp(TZ_INFO[i].psTZFromUnix, psTZName) == 0 &&
248            TZ_INFO[i].bias == bias &&
249            TZ_INFO[i].dst == dst
250          )
251             return TZ_INFO[i].psTZWindows;
252    }
253
254    return (NULL);
255 }
256
257
258 /* TIME_GetBias: helper function calculates delta local time from UTC */
259 static int TIME_GetBias( time_t utc, int *pdaylight)
260 {
261     struct tm *ptm = localtime(&utc);
262     *pdaylight = ptm->tm_isdst; /* daylight for local timezone */
263     ptm = gmtime(&utc);
264     ptm->tm_isdst = *pdaylight; /* use local daylight, not that of Greenwich */
265     return (int)(utc-mktime(ptm));
266 }
267
268
269 /***********************************************************************
270  *              SetLocalTime            (KERNEL32.@)
271  *
272  *  Sets the local time using current time zone and daylight
273  *  savings settings.
274  *
275  * RETURNS
276  *
277  *  True if the time was set, false if the time was invalid or the
278  *  necessary permissions were not held.
279  */
280 BOOL WINAPI SetLocalTime(
281     const SYSTEMTIME *systime) /* [in] The desired local time. */
282 {
283     struct timeval tv;
284     struct tm t;
285     time_t sec;
286     time_t oldsec=time(NULL);
287     int err;
288
289     /* get the number of seconds */
290     t.tm_sec = systime->wSecond;
291     t.tm_min = systime->wMinute;
292     t.tm_hour = systime->wHour;
293     t.tm_mday = systime->wDay;
294     t.tm_mon = systime->wMonth - 1;
295     t.tm_year = systime->wYear - 1900;
296     t.tm_isdst = -1;
297     sec = mktime (&t);
298
299     /* set the new time */
300     tv.tv_sec = sec;
301     tv.tv_usec = systime->wMilliseconds * 1000;
302
303     /* error and sanity check*/
304     if( sec == (time_t)-1 || abs((int)(sec-oldsec)) > SETTIME_MAX_ADJUST ){
305         err = 1;
306         SetLastError(ERROR_INVALID_PARAMETER);
307     } else {
308         err=settimeofday(&tv, NULL); /* 0 is OK, -1 is error */
309         if(err == 0)
310             return TRUE;
311         SetLastError(ERROR_PRIVILEGE_NOT_HELD);
312     }
313     ERR("Cannot set time to %d/%d/%d %d:%d:%d Time adjustment %ld %s\n",
314             systime->wYear, systime->wMonth, systime->wDay, systime->wHour,
315             systime->wMinute, systime->wSecond,
316             sec-oldsec, err == -1 ? "No Permission" : 
317                 sec==(time_t)-1 ? "" : "is too large." );
318     return FALSE;
319 }
320
321
322 /***********************************************************************
323  *           GetSystemTimeAdjustment     (KERNEL32.@)
324  *
325  *  Indicates the period between clock interrupt and the amount the clock
326  *  is adjusted each interrupt so as to keep it insync with an external source.
327  *
328  * RETURNS
329  *
330  *  Always returns true.
331  *
332  * BUGS
333  *
334  *  Only the special case of disabled time adjustments is supported.
335  *  (also the signature is wrong it should have a return type of BOOL)
336  */
337 DWORD WINAPI GetSystemTimeAdjustment(
338     LPDWORD lpTimeAdjustment,         /* [out] The clock adjustment per interupt in 100's of nanoseconds. */
339     LPDWORD lpTimeIncrement,          /* [out] The time between clock interupts in 100's of nanoseconds. */
340     LPBOOL  lpTimeAdjustmentDisabled) /* [out] The clock synchonisation has been disabled. */
341 {
342     *lpTimeAdjustment = 0;
343     *lpTimeIncrement = 0;
344     *lpTimeAdjustmentDisabled = TRUE;
345     return TRUE;
346 }
347
348
349 /***********************************************************************
350  *              SetSystemTime            (KERNEL32.@)
351  *
352  *  Sets the system time (utc).
353  *
354  * RETURNS
355  *
356  *  True if the time was set, false if the time was invalid or the
357  *  necessary permissions were not held.
358  */
359 BOOL WINAPI SetSystemTime(
360     const SYSTEMTIME *systime) /* [in] The desired system time. */
361 {
362     struct timeval tv;
363     struct timezone tz;
364     struct tm t;
365     time_t sec, oldsec;
366     int dst, bias;
367     int err;
368
369     /* call gettimeofday to get the current timezone */
370     gettimeofday(&tv, &tz);
371     oldsec=tv.tv_sec;
372     /* get delta local time from utc */
373     bias=TIME_GetBias(oldsec,&dst);
374
375     /* get the number of seconds */
376     t.tm_sec = systime->wSecond;
377     t.tm_min = systime->wMinute;
378     t.tm_hour = systime->wHour;
379     t.tm_mday = systime->wDay;
380     t.tm_mon = systime->wMonth - 1;
381     t.tm_year = systime->wYear - 1900;
382     t.tm_isdst = dst;
383     sec = mktime (&t);
384     /* correct for timezone and daylight */
385     sec += bias;
386
387     /* set the new time */
388     tv.tv_sec = sec;
389     tv.tv_usec = systime->wMilliseconds * 1000;
390
391     /* error and sanity check*/
392     if( sec == (time_t)-1 || abs((int)(sec-oldsec)) > SETTIME_MAX_ADJUST ){
393         err = 1;
394         SetLastError(ERROR_INVALID_PARAMETER);
395     } else {
396         err=settimeofday(&tv, NULL); /* 0 is OK, -1 is error */
397         if(err == 0)
398             return TRUE;
399         SetLastError(ERROR_PRIVILEGE_NOT_HELD);
400     }
401     ERR("Cannot set time to %d/%d/%d %d:%d:%d Time adjustment %ld %s\n",
402             systime->wYear, systime->wMonth, systime->wDay, systime->wHour,
403             systime->wMinute, systime->wSecond,
404             sec-oldsec, err == -1 ? "No Permission" :
405                 sec==(time_t)-1 ? "" : "is too large." );
406     return FALSE;
407 }
408
409
410 /***********************************************************************
411  *              GetTimeZoneInformation  (KERNEL32.@)
412  *
413  *  Fills in the a time zone information structure with values based on
414  *  the current local time.
415  *
416  * RETURNS
417  *
418  *  The daylight savings time standard or TIME_ZONE_ID_INVALID if the call failed.
419  */
420 DWORD WINAPI GetTimeZoneInformation(
421     LPTIME_ZONE_INFORMATION tzinfo) /* [out] The time zone structure to be filled in. */
422 {
423     time_t gmt;
424     int bias, daylight;
425     const WCHAR *psTZ;
426
427
428     memset(tzinfo, 0, sizeof(TIME_ZONE_INFORMATION));
429
430     gmt = time(NULL);
431     bias=TIME_GetBias(gmt,&daylight);
432
433     tzinfo->Bias = -bias / 60;
434     tzinfo->StandardBias = 0;
435     tzinfo->DaylightBias = -60;
436     psTZ = TIME_GetTZAsStr (gmt, (-bias/60), daylight);
437     if (psTZ) strcpyW( tzinfo->StandardName, psTZ );
438     return TIME_ZONE_ID_STANDARD;
439 }
440
441
442 /***********************************************************************
443  *              SetTimeZoneInformation  (KERNEL32.@)
444  *
445  *  Set the local time zone with values based on the time zone structure.
446  *
447  * RETURNS
448  *
449  *  True on successful setting of the time zone.
450  *
451  * BUGS
452  *
453  *  Use the obsolete unix timezone structure and tz_dsttime member.
454  */
455 BOOL WINAPI SetTimeZoneInformation(
456     const LPTIME_ZONE_INFORMATION tzinfo) /* [in] The new time zone. */
457 {
458     struct timezone tz;
459
460     tz.tz_minuteswest = tzinfo->Bias;
461 #ifdef DST_NONE
462     tz.tz_dsttime = DST_NONE;
463 #else
464     tz.tz_dsttime = 0;
465 #endif
466     return !settimeofday(NULL, &tz);
467 }
468
469
470 /***********************************************************************
471  *              SystemTimeToTzSpecificLocalTime  (KERNEL32.@)
472  *
473  *  Converts the system time (utc) to the local time in the specified time zone.
474  *
475  * RETURNS
476  *
477  *  Returns true when the local time was calculated.
478  *
479  * BUGS
480  *
481  *  Does not handle daylight savings time adjustments correctly.
482  */
483 BOOL WINAPI SystemTimeToTzSpecificLocalTime(
484     LPTIME_ZONE_INFORMATION lpTimeZoneInformation, /* [in] The desired time zone. */
485     LPSYSTEMTIME            lpUniversalTime,       /* [in] The utc time to base local time on. */
486     LPSYSTEMTIME            lpLocalTime)           /* [out] The local time in the time zone. */
487 {
488   FIXME(":stub\n");
489   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
490        return FALSE;
491 }
492
493
494 /***********************************************************************
495  *              GetSystemTimeAsFileTime  (KERNEL32.@)
496  *
497  *  Fills in a file time structure with the current time in UTC format.
498  */
499 VOID WINAPI GetSystemTimeAsFileTime(
500     LPFILETIME time) /* [out] The file time struct to be filled with the system time. */
501 {
502     NtQuerySystemTime( (LARGE_INTEGER *)time );
503 }
504
505
506 /*********************************************************************
507  *      TIME_ClockTimeToFileTime    (olorin@fandra.org, 20-Sep-1998)
508  *
509  *  Used by GetProcessTimes to convert clock_t into FILETIME.
510  *
511  *      Differences to UnixTimeToFileTime:
512  *          1) Divided by CLK_TCK
513  *          2) Time is relative. There is no 'starting date', so there is 
514  *             no need in offset correction, like in UnixTimeToFileTime
515  */
516 static void TIME_ClockTimeToFileTime(clock_t unix_time, LPFILETIME filetime)
517 {
518     LONGLONG secs = RtlEnlargedUnsignedMultiply( unix_time, 10000000 );
519     ((LARGE_INTEGER *)filetime)->QuadPart = RtlExtendedLargeIntegerDivide( secs, CLK_TCK, NULL );
520 }
521
522 /*********************************************************************
523  *      GetProcessTimes                         (KERNEL32.@)
524  *
525  *  Returns the user and kernel execution times of a process,
526  *  along with the creation and exit times if known.
527  *
528  *  olorin@fandra.org:
529  *  Would be nice to subtract the cpu time, used by Wine at startup.
530  *  Also, there is a need to separate times used by different applications.
531  *
532  * RETURNS
533  *
534  *  Always returns true.
535  *
536  * BUGS
537  *
538  *  lpCreationTime, lpExitTime are NOT INITIALIZED.
539  */
540 BOOL WINAPI GetProcessTimes(
541     HANDLE     hprocess,       /* [in] The process to be queried (obtained from PROCESS_QUERY_INFORMATION). */
542     LPFILETIME lpCreationTime, /* [out] The creation time of the process. */
543     LPFILETIME lpExitTime,     /* [out] The exit time of the process if exited. */
544     LPFILETIME lpKernelTime,   /* [out] The time spent in kernal routines in 100's of nanoseconds. */
545     LPFILETIME lpUserTime)     /* [out] The time spent in user routines in 100's of nanoseconds. */
546 {
547     struct tms tms;
548
549     times(&tms);
550     TIME_ClockTimeToFileTime(tms.tms_utime,lpUserTime);
551     TIME_ClockTimeToFileTime(tms.tms_stime,lpKernelTime);
552     return TRUE;
553 }
554
555 /*********************************************************************
556  *      GetCalendarInfoA                                (KERNEL32.@)
557  *
558  */
559 int WINAPI GetCalendarInfoA(LCID Locale, CALID Calendar, CALTYPE CalType,
560                             LPSTR lpCalData, int cchData, LPDWORD lpValue)
561 {
562     FIXME("(%08lx,%08lx,%08lx,%p,%d,%p): stub\n", 
563           Locale, Calendar, CalType, lpCalData, cchData, lpValue);
564     return 0;
565 }
566
567 /*********************************************************************
568  *      GetCalendarInfoW                                (KERNEL32.@)
569  *
570  */
571 int WINAPI GetCalendarInfoW(LCID Locale, CALID Calendar, CALTYPE CalType,
572                             LPWSTR lpCalData, int cchData, LPDWORD lpValue)
573 {       
574     FIXME("(%08lx,%08lx,%08lx,%p,%d,%p): stub\n", 
575           Locale, Calendar, CalType, lpCalData, cchData, lpValue);
576     return 0;
577 }
578
579 /*********************************************************************
580  *      SetCalendarInfoA                                (KERNEL32.@)
581  *
582  */
583 int WINAPI      SetCalendarInfoA(LCID Locale, CALID Calendar, CALTYPE CalType, LPCSTR lpCalData)
584 {
585     FIXME("(%08lx,%08lx,%08lx,%s): stub\n", 
586           Locale, Calendar, CalType, debugstr_a(lpCalData));
587     return 0;
588 }
589
590 /*********************************************************************
591  *      SetCalendarInfoW                                (KERNEL32.@)
592  *
593  */
594 int WINAPI      SetCalendarInfoW(LCID Locale, CALID Calendar, CALTYPE CalType, LPCWSTR lpCalData)
595 {
596     FIXME("(%08lx,%08lx,%08lx,%s): stub\n", 
597           Locale, Calendar, CalType, debugstr_w(lpCalData));
598     return 0;
599 }
600