Module Name: src
Committed By: christos
Date: Thu Dec 16 18:36:48 UTC 2010
Modified Files:
src/include: time.h
Log Message:
Provide a re-entrant and thread-safe set of timezone API's that
don't require locking and can operate on user-specified timezones
as opposed to having to alter the environment to change a timezone.
This work was presented to the tzcode folks and it was generally
accepted, but there seems to be a lot of inertia.
To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/include/time.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/include/time.h
diff -u src/include/time.h:1.39 src/include/time.h:1.40
--- src/include/time.h:1.39 Wed May 13 22:37:36 2009
+++ src/include/time.h Thu Dec 16 13:36:47 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: time.h,v 1.39 2009/05/14 02:37:36 ginsbach Exp $ */
+/* $NetBSD: time.h,v 1.40 2010/12/16 18:36:47 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -174,6 +174,9 @@
#endif
#if defined(_NETBSD_SOURCE)
+
+typedef struct __state *timezone_t;
+
#ifndef __LIBC12_SOURCE__
time_t time2posix(time_t) __RENAME(__time2posix50);
time_t posix2time(time_t) __RENAME(__posix2time50);
@@ -181,10 +184,25 @@
time_t timeoff(struct tm *, long) __RENAME(__timeoff50);
time_t timelocal(struct tm *) __RENAME(__timelocal50);
struct tm *offtime(const time_t *, long) __RENAME(__offtime50);
-#endif
-#ifndef __LIBC12_SOURCE__
void tzsetwall(void) __RENAME(__tzsetwall50);
-#endif
+
+struct tm *offtime_r(const time_t *, long, struct tm *) __RENAME(__offtime_r50);
+struct tm *localtime_rz(const timezone_t, const time_t * __restrict,
+ struct tm * __restrict) __RENAME(__localtime_rz50);
+char *ctime_rz(const timezone_t, const time_t *, char *) __RENAME(__ctime_rz50);
+time_t mktime_z(const timezone_t, struct tm *) __RENAME(__mktime_z50);
+time_t timelocal_z(const timezone_t, struct tm *) __RENAME(__timelocal_z50);
+time_t time2posix_z(const timezone_t, time_t) __RENAME(__time2posix_z50);
+time_t posix2time_z(const timezone_t, time_t) __RENAME(__posix2time_z50);
+timezone_t tzalloc(const char *) __RENAME(__tzalloc50);
+void tzfree(const timezone_t) __RENAME(__tzfree50);
+const char *tzgetname(const timezone_t, int) __RENAME(__tzgetname50);
+#endif
+
+size_t strftime_z(const timezone_t, char * __restrict, size_t,
+ const char * __restrict, const struct tm * __restrict)
+ __attribute__((__format__(__strftime__, 4, 0)));
+
#endif /* _NETBSD_SOURCE */
__END_DECLS