aqbanking  5.7.8
time.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  $RCSfile$
3  -------------------
4  begin : Mon March 2 2011
5  copyright : (C) 2011 by Christian Stimming
6  email : christian@cstimming.de
7 
8  ***************************************************************************
9  * This file is part of the project "AqBanking". *
10  * Please see toplevel file COPYING of that project for license details. *
11  ***************************************************************************/
12 
13 
14 #ifndef AB_TIME_HPP
15 #define AB_TIME_HPP
16 
17 #include <gwenhywfar/gwentime.h>
18 #include <aqbankingpp/cxxwrap.hpp>
19 
20 namespace AB
21 {
22 
24 class Time
25 {
26 public:
27  typedef GWEN_TIME wrapped_type;
28 private:
29  wrapped_type* m_ptr;
30 public:
31 
32  Time(int year,
33  int month,
34  int day,
35  int hour,
36  int min,
37  int sec,
38  int inUtc)
39  : m_ptr(GWEN_Time_new(year, month, day,
40  hour, min, sec, inUtc))
41  {}
42  AB_CXXWRAP_CONSTRUCTORS(Time, GWEN_Time);
43 
44  uint32_t AB_CXXWRAP_GET0_CONST(seconds, GWEN_Time_Seconds);
45  double AB_CXXWRAP_GET0_CONST(milliseconds, GWEN_Time_Milliseconds);
46  struct tm AB_CXXWRAP_GET0_CONST(toTm, GWEN_Time_toTm);
47  time_t AB_CXXWRAP_GET0_CONST(toTime_t, GWEN_Time_toTime_t);
48 
52  int getBrokenDownDate(int& day, int& month, int& year)
53  {
54  return GWEN_Time_GetBrokenDownDate(m_ptr, &day, &month, &year);
55  }
59  int getBrokenDownUtcDate(int& day, int& month, int& year)
60  {
61  return GWEN_Time_GetBrokenDownUtcDate(m_ptr, &day, &month, &year);
62  }
63 
64  static Time currentTime()
65  {
66  return GWEN_CurrentTime();
67  }
68 };
69 
70 } // END namespace AB
71 
72 #endif // AB_TIME_HPP
int getBrokenDownUtcDate(int &day, int &month, int &year)
Definition: time.hpp:59
static Time currentTime()
Definition: time.hpp:64
uint32_t AB_CXXWRAP_GET0_CONST(seconds, GWEN_Time_Seconds)
int getBrokenDownDate(int &day, int &month, int &year)
Definition: time.hpp:52
GWEN_TIME wrapped_type
Definition: time.hpp:27
Time(int year, int month, int day, int hour, int min, int sec, int inUtc)
Definition: time.hpp:32
AB_CXXWRAP_CONSTRUCTORS(Time, GWEN_Time)