Local time

#include <x/tzfile.H>
#include <x/ymdhms.H>

time_t t=time(NULL);

x::ymdhms now(t, x::tzfile::base::local());

x::ymd now_date(now);
x::hms now_time(now);

A x::ymdhms combines x::ymd, x::hms, and a x::tzfile to specify a date and time expressed in a timezone. A number of constructors are available for creating x::ymdhms from alternate sources; such as a time_t calendar time value and a timezone; or an explicit x::ymd and x::hms objects, together with a timezone; or a C library tm structure.

x::ymdhms implements a convenience toString() method that instantiates a x::strftime object, and uses it to format the x::ymdhms, accordingly.

See the reference documentation for a more complete description of x::ymdhms. Note that this class incurs more overhead than the tm-related functions in the C library. Basic needs that can be satisfied by C library functions should use them. Use this class for complicated requirements that cannot be easily satisfied by the C library, such as pulling apart the date and time components, and/or date/time arithmetic.