[hackers] [scc] [libc] Add time.h || Quentin Rameau

From: <git_AT_suckless.org>
Date: Tue, 21 Feb 2017 19:42:00 +0100 (CET)

commit 0f9980fc8dbb5d51b6442f892aa2c31a9c05c768
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Tue Feb 21 18:28:19 2017 +0100
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Tue Feb 21 19:41:25 2017 +0100

    [libc] Add time.h

diff --git a/libc/include/bits/amd64-sysv/arch/time.h b/libc/include/bits/amd64-sysv/arch/time.h
new file mode 100644
index 0000000..03a8863
--- /dev/null
+++ b/libc/include/bits/amd64-sysv/arch/time.h
_AT_@ -0,0 +1,11 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+typedef long int time_t;
diff --git a/libc/include/bits/i386-sysv/arch/time.h b/libc/include/bits/i386-sysv/arch/time.h
new file mode 100644
index 0000000..03a8863
--- /dev/null
+++ b/libc/include/bits/i386-sysv/arch/time.h
_AT_@ -0,0 +1,11 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+typedef long int time_t;
diff --git a/libc/include/bits/qbe/arch/time.h b/libc/include/bits/qbe/arch/time.h
new file mode 100644
index 0000000..03a8863
--- /dev/null
+++ b/libc/include/bits/qbe/arch/time.h
_AT_@ -0,0 +1,11 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#ifndef _SIZET
+typedef unsigned long size_t;
+#define _SIZET
+#endif
+
+typedef long int time_t;
diff --git a/libc/include/bits/z80/arch/time.h b/libc/include/bits/z80/arch/time.h
new file mode 100644
index 0000000..1436245
--- /dev/null
+++ b/libc/include/bits/z80/arch/time.h
_AT_@ -0,0 +1,11 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef NULL
+#define NULL ((void *) 0)
+#endif
+
+#ifndef _SIZET
+typedef unsigned size_t;
+#define _SIZET
+#endif
+
+typedef long time_t;
diff --git a/libc/include/time.h b/libc/include/time.h
new file mode 100644
index 0000000..c820164
--- /dev/null
+++ b/libc/include/time.h
_AT_@ -0,0 +1,34 @@
+#ifndef _TIME_H
+#define _TIME_H
+
+#include <arch/time.h>
+
+#define CLOCKS_PER_SEC 1000000
+
+typedef long int clock_t;
+
+struct tm {
+ int tm_sec;
+ int tm_min;
+ int tm_hour;
+ int tm_mday;
+ int tm_mon;
+ int tm_year;
+ int tm_wday;
+ int tm_yday;
+ int tm_isdst;
+};
+
+extern clock_t clock(void);
+extern double difftime(time_t time1, time_t time0);
+extern time_t mktime(struct tm *timeptr);
+extern time_t time(time_t *timer);
+extern char *asctime(const struct tm *timeptr);
+extern char *ctime(const time_t *timer);
+extern struct tm *gmtime(const time_t *timer);
+extern struct tm *localtime(const time_t *timer);
+extern size_t strftime(char * restrict s, size_t maxsize,
+ const char * restrict format,
+ const struct tm * restrict timeptr);
+
+#endif
Received on Tue Feb 21 2017 - 19:42:00 CET

This archive was generated by hypermail 2.3.0 : Tue Feb 21 2017 - 19:48:43 CET