No-op; comments.
[libdcp.git] / src / local_time.h
1 /*
2     Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 /** @file  src/local_time.h
21  *  @brief LocalTime class.
22  */
23
24 #ifndef LIBDCP_LOCAL_TIME_H
25 #define LIBDCP_LOCAL_TIME_H
26
27 #include <boost/date_time/posix_time/posix_time.hpp>
28 #include <string>
29
30 class local_time_test;
31
32 namespace dcp {
33
34 /** @class LocalTime
35  *  @brief A representation of a local time (down to the second), including its offset
36  *  from GMT.
37  *
38  *  I tried to use boost for this, really I did, but I could not get it
39  *  to parse strings of the required format (those that include time zones).
40  */
41 class LocalTime
42 {
43 public:
44         LocalTime ();
45         LocalTime (boost::posix_time::ptime);
46         LocalTime (std::string);
47
48         std::string as_string () const;
49         std::string date () const;
50         std::string time_of_day () const;
51
52 private:
53         friend class ::local_time_test;
54
55         void set_local_time_zone ();
56
57         /* Local time */
58         int _year;   ///< year
59         int _month;  ///< month number of the year (1-12)
60         int _day;    ///< day number of the month (1-31)
61         int _hour;   ///< hour number of the day (0-23)
62         int _minute; ///< minute number of the hour (0-59)
63         int _second; ///< second number of the minute (0-59)
64
65         int _tz_hour;   ///< hours by which this time is offset from UTC
66         int _tz_minute; ///< minutes by which this time is offset from UTC
67 };
68
69 }
70
71 #endif