Module XmlRpcDateTime


module XmlRpcDateTime: sig .. end
Date/time type.


Types


exception Parse_error of string
Raised by XmlRpcDateTime.of_string if a string could not be parsed. The exception contains the input string.
type t = int * int * int * int * int * int * int 
Type of XmlRpc-compatible date/time values. (year, month, day, hour, minute, second, time zone offset in minutes)

Comparison


val compare : t -> t -> int
Standard comparator for date/time values. Converts all values to UTC before comparing to ensure correct behavior with values of differing time zones.
val equal : t -> t -> bool
Standard equality function for date/time values. Converts all values to UTC before comparing.
val hash : t -> int
Standard hash function for date/time values. Converts values to UTC before hashing.

Current date and time


val now : unit -> t
Returns the current date and time in the local time zone.
val now_utc : unit -> t
Returns the current date and time in UTC.

Time zone adjustments


val set_tz_offset : int -> t -> t
Adjusts the time zone offset, preserving equality.
val fix_tz_offset : int -> t -> t
Forces the time zone offset to a different value, ignoring all other fields. Use this to correct the time zone of a date/time value that was received without a time zone offset and is known not to be UTC.

Conversion


val from_unixfloat : float -> t
Builds a date/time value from epoch seconds in the local time zone.
val from_unixfloat_utc : float -> t
Builds a date/time value from epoch seconds in UTC.
val to_unixfloat : t -> float
Converts a date/time value to epoch seconds in the local time zone.
val to_unixfloat_utc : t -> float
Converts a date/time value to epoch seconds in UTC.
val from_unixtm : Unix.tm -> t
Builds a date/time value from a Unix.tm value in the local time zone.
val from_unixtm_utc : Unix.tm -> t
Builds a date/time value from a Unix.tm value in UTC.
val to_unixtm : t -> Unix.tm
Converts a date/time value to a Unix.tm value in the local time zone.
val to_unixtm_utc : t -> Unix.tm
Converts a date/time value to a Unix.tm value in UTC.

ISO-8601 parsing and generation


val of_string : string -> t
Parses an (XmlRpc-flavor) ISO-8601 date/time value from a string.
val to_string : t -> string
Generates an ISO-8601 string from a date/time value.