eformat::helper::DateAndTime Class Reference

#include <DateAndTime.h>

List of all members.

Public Member Functions

 DateAndTime ()
 DateAndTime (uint32_t val)
uint32_t code (void) const
std::string iso8601 (void) const
std::string human (void) const

Private Attributes

uint32_t m_val
 my current value


Detailed Description

Interprets and composes a date and time field (32-bit unsigned integer)

Definition at line 26 of file DateAndTime.h.


Constructor & Destructor Documentation

eformat::helper::DateAndTime::DateAndTime (  ) 

Default constructor, it means, now

Definition at line 16 of file DateAndTime.cxx.

00017   : m_val(time(0))
00018 {
00019 }

eformat::helper::DateAndTime::DateAndTime ( uint32_t  val  ) 

Build from an existing date in time

Parameters:
val The value of the compiled date and time field

Definition at line 21 of file DateAndTime.cxx.

00022   : m_val(val)
00023 {
00024 }


Member Function Documentation

uint32_t eformat::helper::DateAndTime::code ( void   )  const [inline]

Get the current representation

Definition at line 45 of file DateAndTime.h.

References m_val.

Referenced by human(), and iso8601().

00045 { return m_val; } 

std::string eformat::helper::DateAndTime::human ( void   )  const

Returns a string that represents the time in a human readable format

Definition at line 36 of file DateAndTime.cxx.

References code().

00037 {
00038   struct tm t;
00039   time_t val = code();
00040   gmtime_r(&val, &t);
00041   char buf[100];
00042   strftime(buf, 100, "%a, %d %b %Y %H:%M:%S UTC", &t);
00043   return buf;
00044 }

std::string eformat::helper::DateAndTime::iso8601 ( void   )  const

Returns a string that represents the time in ISO8601

Definition at line 26 of file DateAndTime.cxx.

References code().

00027 {
00028   struct tm t;
00029   time_t val = code();
00030   gmtime_r(&val, &t);
00031   char buf[100];
00032   strftime(buf, 100, "%Y-%m-%dT%H:%M:%SZ", &t);
00033   return buf;
00034 }


Member Data Documentation

uint32_t eformat::helper::DateAndTime::m_val [private]

my current value

Definition at line 59 of file DateAndTime.h.

Referenced by code().


Generated on Tue Nov 29 23:36:30 2016 for BOSS_7.0.2 by  doxygen 1.4.7