xref: /reactos/sdk/lib/crt/time/strtime.c (revision 8a978a17)
1 /*
2  * COPYRIGHT:   See COPYING in the top level directory
3  * PROJECT:     ReactOS system libraries
4  * FILE:        lib/sdk/crt/time/strtime.c
5  * PURPOSE:     Fills a buffer with a formatted time representation
6  * PROGRAMER:   Ariadne
7  * UPDATE HISTORY:
8  *              28/12/98: Created
9  */
10 #include <precomp.h>
11 
12 /*
13  * @implemented
14  */
15 char* _strtime(char* time)
16 {
17    static const char format[] = "HH':'mm':'ss";
18 
19    GetTimeFormatA(LOCALE_NEUTRAL, 0, NULL, format, time, 9);
20 
21    return time;
22 }
23 
24 int CDECL _strtime_s(char* time, size_t size)
25 {
26     if(time && size)
27         time[0] = '\0';
28 
29     if(!time) {
30         *_errno() = EINVAL;
31         return EINVAL;
32     }
33 
34     if(size < 9) {
35         *_errno() = ERANGE;
36         return ERANGE;
37     }
38 
39     _strtime(time);
40     return 0;
41 }
42