VideoTools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
gvtimezone.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2017 Graeme Walker
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 3 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, see <http://www.gnu.org/licenses/>.
16 // ===
17 ///
18 /// \file gvtimezone.h
19 ///
20 
21 #ifndef GV_TIMEZONE__H
22 #define GV_TIMEZONE__H
23 
24 #include "gdef.h"
25 #include <string>
26 
27 namespace Gv
28 {
29  class Timezone ;
30 }
31 
32 /// \class Gv::Timezone
33 /// A representation of a timezone.
34 ///
36 {
37 public:
38  explicit Timezone( int hours = 0 ) ;
39  ///< Constructor.
40 
41  explicit Timezone( const std::string & hours ) ;
42  ///< Constructor with support for for half hours (eg. "-8.5").
43  ///< Throws on error.
44 
45  bool zero() const ;
46  ///< Returns true for utc.
47 
48  std::string str() const ;
49  ///< Returns a five-character "+/-hhmm" representation.
50 
51  std::time_t seconds() const ;
52  ///< Returns the offset as a signed number of seconds.
53 
54 private:
55  int m_minutes ;
56 } ;
57 
58 #endif
Timezone(int hours=0)
Constructor.
Definition: gvtimezone.cpp:30
std::time_t seconds() const
Returns the offset as a signed number of seconds.
Definition: gvtimezone.cpp:63
A representation of a timezone.
Definition: gvtimezone.h:35
std::string str() const
Returns a five-character "+/-hhmm" representation.
Definition: gvtimezone.cpp:69
bool zero() const
Returns true for utc.
Definition: gvtimezone.cpp:58