ocean.text.convert.TimeStamp

Converts between native and text representations of HTTP time values. Internally, time is represented as UTC with an epoch fixed at Jan 1st 1970. The text representation is formatted in accordance with RFC 1123, and the parser will accept one of RFC 1123, RFC 850, or asctime formats.

See http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html for further detail.

Applying the D "import alias" mechanism to this module is highly recommended, in order to limit namespace pollution:

import TimeStamp = ocean.text.convert.TimeStamp;

auto t = TimeStamp.parse ("Sun, 06 Nov 1994 08:49:37 GMT");

Members

Functions

asctime
size_t asctime(T[] src, Time value)

ANSI C's asctime() format :: "Sun Nov 6 08:49:37 1994"

asctime
size_t asctime(T[] src, TimeOfDay tod, Date date)

ANSI C's asctime() format :: "Sun Nov 6 08:49:37 1994"

dostime
size_t dostime(T[] src, Time value)

DOS time format :: "12-31-06 08:49AM"

dostime
size_t dostime(T[] src, TimeOfDay tod, Date date)

DOS time format :: "12-31-06 08:49AM"

format
const(T)[] format(T[] output, U t)

RFC1123 formatted time

format
const(T)[] format(T[] output, Time t)
Undocumented in source. Be warned that the author may not have intended to support it.
format8601
const(T)[] format8601(T[] output, U t)

ISO-8601 format :: "2006-01-31T14:49:30Z"

format8601
const(T)[] format8601(T[] output, Time t)
Undocumented in source. Be warned that the author may not have intended to support it.
iso8601
size_t iso8601(T[] src, Time value)

ISO-8601 format :: "2006-01-31 14:49:30,001"

iso8601
size_t iso8601(T[] src, TimeOfDay tod, Date date)

ISO-8601 format :: "2006-01-31 14:49:30,001"

parse
Time parse(T[] src, uint* ate)

Parse provided input and return a UTC epoch time. A return value of Time.max (or false, respectively) indicated a parse-failure.

parse
bool parse(T[] src, TimeOfDay tod, Date date, uint* ate)

Parse provided input and return a UTC epoch time. A return value of Time.max (or false, respectively) indicated a parse-failure.

rfc1123
size_t rfc1123(T[] src, Time value)

RFC 822, updated by RFC 1123 :: "Sun, 06 Nov 1994 08:49:37 GMT"

rfc1123
size_t rfc1123(T[] src, TimeOfDay tod, Date date)

RFC 822, updated by RFC 1123 :: "Sun, 06 Nov 1994 08:49:37 GMT"

rfc850
size_t rfc850(T[] src, Time value)

RFC 850, obsoleted by RFC 1036 :: "Sunday, 06-Nov-94 08:49:37 GMT"

rfc850
size_t rfc850(T[] src, TimeOfDay tod, Date date)

RFC 850, obsoleted by RFC 1036 :: "Sunday, 06-Nov-94 08:49:37 GMT"

toString
char[] toString(Time time)

Template wrapper to make life simpler. Returns a text version of the provided value.

toTime
ulong toTime(T[] src)

Parse provided input and return a UTC epoch time. An exception is raised where the provided string is not fully parsed.

Meta

License

Tango Dual License: 3-Clause BSD License / Academic Free License v3.0. See LICENSE_TANGO.txt for details.

Version

Initial release: May 2005