:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[reactos.git] / lib / msvcrt / time / strtime.c
1 /*
2  * COPYRIGHT:   See COPYING in the top level directory
3  * PROJECT:     ReactOS system libraries
4  * FILE:        lib/msvcrt/time/strtime.c
5  * PURPOSE:     Fills a buffer with a formatted time representation
6  * PROGRAMER:   Boudewijn Dekker
7  * UPDATE HISTORY:
8  *              28/12/98: Created
9  */
10 #include <msvcrt/time.h>
11 #include <msvcrt/stdio.h>
12 #include <msvcrt/errno.h>
13 #include <msvcrt/internal/file.h>
14
15 char *_strtime(char* buf)
16 {
17   time_t t;
18   struct tm *d;
19   char *dt = (char *)buf;
20
21   if ( buf == NULL )
22     {
23       __set_errno(EINVAL);
24       return NULL;
25     }
26   t =  time(NULL);
27   d = localtime(&t);
28   sprintf(dt,"%d:%d:%d",d->tm_hour,d->tm_min,d->tm_sec);
29   return dt;
30 }
31
32 wchar_t *_wstrtime(wchar_t* buf)
33 {
34   time_t t;
35   struct tm *d;
36   wchar_t *dt = (wchar_t *)buf;
37
38   if ( buf == NULL )
39     {
40       __set_errno(EINVAL);
41       return NULL;
42     }
43   t =  time(NULL);
44   d = localtime(&t);
45   swprintf(dt,L"%d:%d:%d",d->tm_hour,d->tm_min,d->tm_sec);
46   return dt;
47 }