aqbanking 5.0.14
time.hpp
Go to the documentation of this file.
00001 /***************************************************************************
00002  $RCSfile$
00003                              -------------------
00004     begin       : Mon March 2 2011
00005     copyright   : (C) 2011 by Christian Stimming
00006     email       : christian@cstimming.de
00007 
00008  ***************************************************************************
00009  * This file is part of the project "AqBanking".                           *
00010  * Please see toplevel file COPYING of that project for license details.   *
00011  ***************************************************************************/
00012 
00013 
00014 #ifndef AB_TIME_HPP
00015 #define AB_TIME_HPP
00016 
00017 #include <gwenhywfar/gwentime.h>
00018 #include <aqbankingpp/cxxwrap.hpp>
00019   
00020 namespace AB
00021 {
00022 
00024 class Time
00025 {
00026 public:
00027   typedef GWEN_TIME wrapped_type;
00028 private:
00029   wrapped_type* m_ptr;
00030 public:
00031 
00032   Time(int year,
00033            int month,
00034            int day,
00035            int hour,
00036            int min,
00037            int sec,
00038            int inUtc)
00039         : m_ptr(GWEN_Time_new(year, month, day,
00040                                                   hour, min, sec, inUtc))
00041   {}
00042   AB_CXXWRAP_CONSTRUCTORS(Time, GWEN_Time);
00043 
00044   uint32_t AB_CXXWRAP_GET0_CONST(seconds, GWEN_Time_Seconds);
00045   double AB_CXXWRAP_GET0_CONST(milliseconds, GWEN_Time_Milliseconds);
00046   struct tm AB_CXXWRAP_GET0_CONST(toTm, GWEN_Time_toTm);
00047   time_t AB_CXXWRAP_GET0_CONST(toTime_t, GWEN_Time_toTime_t);
00048 
00052   int getBrokenDownDate(int& day, int& month, int& year)
00053   {
00054         return GWEN_Time_GetBrokenDownDate(m_ptr, &day, &month, &year);
00055   }
00059   int getBrokenDownUtcDate(int& day, int& month, int& year)
00060   {
00061         return GWEN_Time_GetBrokenDownUtcDate(m_ptr, &day, &month, &year);
00062   }
00063 
00064   static Time currentTime()
00065   {
00066         return GWEN_CurrentTime();
00067   }
00068 };
00069 
00070 } // END namespace AB
00071 
00072 #endif // AB_TIME_HPP