summaryrefslogtreecommitdiff
path: root/utils/utils.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-05-13 16:37:49 +0100
committerVincent Sanders <vince@kyllikki.org>2014-05-13 16:37:49 +0100
commit1a3ee6090d2fdb81bef935929938af20279bc879 (patch)
treec3a0418511e29c9a245a3d87ae146d117d5e3591 /utils/utils.c
parent6c466c985f3c39df995b886c2b95f307d1285045 (diff)
downloadnetsurf-1a3ee6090d2fdb81bef935929938af20279bc879.tar.gz
netsurf-1a3ee6090d2fdb81bef935929938af20279bc879.tar.bz2
add strptime compatability
Diffstat (limited to 'utils/utils.c')
-rw-r--r--utils/utils.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/utils/utils.c b/utils/utils.c
index c036ff2f7..9bccf2b90 100644
--- a/utils/utils.c
+++ b/utils/utils.c
@@ -561,3 +561,30 @@ int inet_pton(int af, const char *src, void *dst)
#endif
+
+#ifndef HAVE_STRPTIME
+
+/**
+ * naff strptime implementation for risc os and windows.
+ *
+ * @warning only supports %s format
+ */
+char *nsc_time_strptime(const char *s, const char *format, struct tm *tm)
+{
+ time_t esecs;
+ struct tm *gtm;
+ char *endptr;
+
+ if ((format[0] != '%') || (format[1] != 's')) {
+ return NULL
+ }
+
+ esecs = (time_t)strtoll(a, &endptr, 10);
+
+ gtm = gmtime(esecs);
+ *tm = *gtm;
+
+ return endptr;
+}
+
+#endif