BSD style: see
license.txt
Initial release: May 2005
Kris
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:
1
2
3
| import TimeStamp = tango.text.convert.TimeStamp;
auto t = TimeStamp.parse ("Sun, 06 Nov 1994 08:49:37 GMT");
|
- ulong toTime(T)(T[] src) ¶#
-
Parse provided input and return a UTC epoch time. An exception
is raised where the provided string is not fully parsed.
- char[] toString(Time time) ¶#
-
Template wrapper to make life simpler. Returns a text version
of the provided value.
See format() for details
- wchar[] toString16(Time time) ¶#
-
Template wrapper to make life simpler. Returns a text version
of the provided value.
See format() for details
- dchar[] toString32(Time time) ¶#
-
Template wrapper to make life simpler. Returns a text version
of the provided value.
See format() for details
- T[] format(T, U = Time)(T[] output, U t) ¶#
-
RFC1123 formatted time
Converts to the format "Sun, 06 Nov 1994 08:49:37 GMT", and
returns a populated slice of the provided buffer. Note that
RFC1123 format is always in absolute GMT time, and a thirty-
element buffer is sufficient for the produced output
Throws an exception where the supplied time is invalid
- T[] format8601(T, U = Time)(T[] output, U t) ¶#
-
ISO-8601 format :: "2006-01-31T14:49:30Z"
Throws an exception where the supplied time is invalid
- Time parse(T)(T[] src, uint* ate = null) ¶#
-
Parse provided input and return a UTC epoch time. A return value
of Time.max indicated a parse-failure.
An option is provided to return the count of characters parsed -
an unchanged value here also indicates invalid input.
- int rfc1123(T)(T[] src, inout Time value) ¶#
-
RFC 822, updated by RFC 1123 :: "Sun, 06 Nov 1994 08:49:37 GMT"
Returns the number of elements consumed by the parse; zero if
the parse failed
- int rfc850(T)(T[] src, inout Time value) ¶#
-
RFC 850, obsoleted by RFC 1036 :: "Sunday, 06-Nov-94 08:49:37 GMT"
Returns the number of elements consumed by the parse; zero if
the parse failed
- int asctime(T)(T[] src, inout Time value) ¶#
-
ANSI C's asctime() format :: "Sun Nov 6 08:49:37 1994"
Returns the number of elements consumed by the parse; zero if
the parse failed
- int dostime(T)(T[] src, inout Time value) ¶#
-
DOS time format :: "12-31-06 08:49AM"
Returns the number of elements consumed by the parse; zero if
the parse failed
- int iso8601(T)(T[] src, inout Time value) ¶#
-
ISO-8601 format :: "2006-01-31 14:49:30,001"
Returns the number of elements consumed by the parse; zero if
the parse failed
- bool time(T)(inout TimeOfDay time, inout T* p) [private] ¶#
-
Parse a time field
- int parseMonth(T)(inout T* p) [private] ¶#
-
Match a month from the input
- int parseShortDay(T)(inout T* p) [private] ¶#
-
Match a day from the input
- int parseFullDay(T)(inout T* p) [private] ¶#
-
Match a day from the input. Sunday is 0
- int parseInt(T)(inout T* p) [private, static] ¶#
-
Extract an integer from the input