summaryrefslogtreecommitdiffstats
path: root/private/crt32/time/ctime.c
diff options
context:
space:
mode:
authorAdam <you@example.com>2020-05-17 05:51:50 +0200
committerAdam <you@example.com>2020-05-17 05:51:50 +0200
commite611b132f9b8abe35b362e5870b74bce94a1e58e (patch)
treea5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/crt32/time/ctime.c
downloadNT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip
Diffstat (limited to 'private/crt32/time/ctime.c')
-rw-r--r--private/crt32/time/ctime.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/private/crt32/time/ctime.c b/private/crt32/time/ctime.c
new file mode 100644
index 000000000..28e48c43b
--- /dev/null
+++ b/private/crt32/time/ctime.c
@@ -0,0 +1,56 @@
+/***
+*ctime.c - convert time argument into ASCII string
+*
+* Copyright (c) 1985-1991, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* contains ctime() - convert time value to string
+*
+*Revision History:
+* 03-??-84 RLB initial version
+* 05-??-84 DFW split off into seperate module
+* 02-18-87 JCR put in NULL ptr support
+* 04-10-87 JCR changed long declaration ot time_t and added const.
+* 12-11-87 JCR Added "_LOAD_DS" to declaration
+* 03-20-90 GJF Replaced _LOAD_DS with _CALLTYPE1, added #include
+* <cruntime.h> and fixed the copyright. Also, cleaned
+* up the formatting a bit.
+* 05-21-90 GJF Fixed compiler warning.
+* 10-04-90 GJF New-style function declarators.
+*
+*******************************************************************************/
+
+#include <cruntime.h>
+#include <time.h>
+#include <stddef.h>
+
+/***
+*char *ctime(time) - converts a time stored as a long to a ASCII string
+*
+*Purpose:
+* Converts a time stored as a long (time_t) to an ASCII string of
+* the form:
+* Tue May 1 14:25:03 1984
+*
+*Entry:
+* long *time - time value in XENIX format
+*
+*Exit:
+* returns pointer to static string or NULL if time is before
+* Jan 1 1980.
+*
+*Exceptions:
+*
+*******************************************************************************/
+
+char * _CALLTYPE1 ctime (
+ const time_t *timp
+ )
+{
+ struct tm *tmtemp;
+
+ if ((tmtemp=localtime(timp)) != NULL)
+ return(asctime((const struct tm *)tmtemp));
+ else
+ return(NULL);
+}