40 #ifndef LIBDCP_LOCAL_TIME_H
41 #define LIBDCP_LOCAL_TIME_H
44 #include <boost/date_time/posix_time/posix_time.hpp>
48 class local_time_basic_test;
74 explicit LocalTime (boost::posix_time::ptime);
80 LocalTime (boost::posix_time::ptime,
int tz_hour,
int tz_minute);
86 std::string
as_string (
bool with_millisecond =
false)
const;
89 std::string
date ()
const;
92 std::string
time_of_day (
bool with_second,
bool with_millisecond)
const;
110 int minute ()
const {
114 int second ()
const {
118 void set_year (
int y) {
122 void add_days (
int d);
123 void add_months (
int a);
124 void add_minutes (
int a);
126 static LocalTime from_asn1_utc_time (std::string time);
127 static LocalTime from_asn1_generalized_time (std::string time);
129 bool operator== (
LocalTime const & other)
const;
130 bool operator!= (
LocalTime const & other)
const;
131 bool operator< (
LocalTime const & other)
const;
134 friend class ::local_time_basic_test;
136 void set (
struct tm
const * tm);
137 void set (boost::posix_time::ptime);
158 operator<< (std::ostream& s,
LocalTime const & t);
A representation of a local time (down to the second), including its offset from GMT (equivalent to x...
std::string as_string(bool with_millisecond=false) const
int _day
day number of the month (1-31)
int _hour
hour number of the day (0-23)
int _tz_hour
hours by which this time is offset from UTC; can be negative
int _millisecond
millisecond number of the second (0-999)
std::string time_of_day(bool with_second, bool with_millisecond) const
void set_local_time_zone()
int _second
second number of the minute (0-59)
int _month
month number of the year (1-12)
int _minute
minute number of the hour (0-59)
Namespace for everything in libdcp.