BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
eformat::helper::DateAndTime Class Reference

#include <DateAndTime.h>

Public Member Functions

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

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

◆ DateAndTime() [1/2]

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

Default constructor, it means, now

Definition at line 16 of file DateAndTime.cxx.

17 : m_val(time(0))
18{
19}
Double_t time

◆ DateAndTime() [2/2]

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

Build from an existing date in time

Parameters
valThe value of the compiled date and time field

Definition at line 21 of file DateAndTime.cxx.

22 : m_val(val)
23{
24}

Member Function Documentation

◆ code()

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

Get the current representation

Definition at line 45 of file DateAndTime.h.

45{ return m_val; }

◆ human()

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.

37{
38 struct tm t;
39 time_t val = code();
40 gmtime_r(&val, &t);
41 char buf[100];
42 strftime(buf, 100, "%a, %d %b %Y %H:%M:%S UTC", &t);
43 return buf;
44}
uint32_t code(void) const
Definition: DateAndTime.h:45
int t()
Definition: t.c:1

◆ iso8601()

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.

27{
28 struct tm t;
29 time_t val = code();
30 gmtime_r(&val, &t);
31 char buf[100];
32 strftime(buf, 100, "%Y-%m-%dT%H:%M:%SZ", &t);
33 return buf;
34}

The documentation for this class was generated from the following files: