# HG changeset patch # User Adam Chlipala # Date 1293565917 18000 # Node ID 268d9af9103fe3d9b6862e09b167c98dd7cd6d19 # Parent 4e5ca2a77a4d43cf0cdea97f56245969c9a46157 Basis.readUtc diff -r 4e5ca2a77a4d -r 268d9af9103f include/urweb.h --- a/include/urweb.h Mon Dec 27 12:08:00 2010 -0500 +++ b/include/urweb.h Tue Dec 28 14:51:57 2010 -0500 @@ -320,4 +320,6 @@ void uw_setQueryString(uw_context, uw_Basis_string); uw_Basis_string uw_queryString(uw_context); +uw_Basis_time *uw_Basis_readUtc(uw_context, uw_Basis_string); + #endif diff -r 4e5ca2a77a4d -r 268d9af9103f lib/ur/basis.urs --- a/lib/ur/basis.urs Mon Dec 27 12:08:00 2010 -0500 +++ b/lib/ur/basis.urs Tue Dec 28 14:51:57 2010 -0500 @@ -144,6 +144,7 @@ val minTime : time val addSeconds : time -> int -> time val timef : string -> time -> string (* Uses strftime() format string *) +val readUtc : string -> option time (** * Encryption *) diff -r 4e5ca2a77a4d -r 268d9af9103f src/c/urweb.c --- a/src/c/urweb.c Mon Dec 27 12:08:00 2010 -0500 +++ b/src/c/urweb.c Tue Dec 28 14:51:57 2010 -0500 @@ -3661,3 +3661,14 @@ return !!(uw_Basis_eq_time(ctx, t1, t2) || uw_Basis_lt_time(ctx, t1, t2)); } +uw_Basis_time *uw_Basis_readUtc(uw_context ctx, uw_Basis_string s) { + uw_Basis_time *r = uw_Basis_stringToTime(ctx, s); + + if (r) { + struct tm tm; + localtime_r(&r->seconds, &tm); + r->seconds -= tm.tm_gmtoff; + } + + return r; +}