40 #ifndef LIBDCP_LOCAL_TIME_H
41 #define LIBDCP_LOCAL_TIME_H
44 #include "utc_offset.h"
45 #include <boost/date_time/posix_time/posix_time.hpp>
49 struct local_time_basic_test;
78 explicit LocalTime (boost::posix_time::ptime);
98 std::string
as_string(
bool with_millisecond =
false,
bool with_timezone =
true)
const;
101 std::string
date ()
const;
104 std::string
time_of_day (
bool with_second,
bool with_millisecond)
const;
122 int minute ()
const {
126 int second ()
const {
130 int millisecond()
const {
134 void set_day(
int d) {
138 void set_month(
int m) {
142 void set_year (
int y) {
150 void add_days (
int d);
151 void add_months (
int a);
152 void add_minutes (
int a);
154 void add(boost::posix_time::time_duration duration);
156 static LocalTime from_asn1_utc_time (std::string time);
157 static LocalTime from_asn1_generalized_time (std::string time);
159 bool operator== (
LocalTime const & other)
const;
160 bool operator!= (
LocalTime const & other)
const;
161 bool operator< (
LocalTime const & other)
const;
162 bool operator<=(
LocalTime const & other)
const;
163 bool operator>(
LocalTime const & other)
const;
164 bool operator>=(
LocalTime const & other)
const;
167 friend struct ::local_time_basic_test;
169 void set (
struct tm
const * tm);
170 void set (boost::posix_time::ptime);
188 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...
int _day
day number of the month (1-31)
int _hour
hour number of the day (0-23)
int _millisecond
millisecond number of the second (0-999)
std::string time_of_day(bool with_second, bool with_millisecond) const
std::string as_string(bool with_millisecond=false, bool with_timezone=true) 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.