UTIL::LCTime Class Reference

Helper class that allows to convert time stamps as defined in LCEvent::getTimeStamp() ( ns since 1.1.1970 00:00:00 UTC) to ordinary date and time and vice versa. More...

#include <UTIL/LCTime.h>

List of all members.

Classes

struct  CalendarTime
 Helper struct that holds the calendar time. More...

Public Member Functions

 LCTime ()
 Init with current time ( accuracy depends on OS/machine,etc.
 LCTime (EVENT::long64 time)
 Init from 64 bit time stamp ( ns since 1.1.1970 00:00:00 ).
 LCTime (int year, int month, int day, int hour=0, int min=0, int s=0)
 Init from date and time.
 LCTime (int unixTime)
 Init from unix time ( s since 1.1.1970 00:00:00 ).
int unixTime () const
 Unix time ( s since 1.1.1970 00:00:00 ).
EVENT::long64 timeStamp () const
 64bit time stamp as used in LCEvent::getTimestamp().
bool isLeapYear (int y) const
 True if the year is a leap year in the Gregorian calendar:
year is multiple of 4 and not multiple of 100
or year is multiple of 400.
int daysInYear (int y) const
 The number if days in the given year in the Gregorian calendar.
int daysInMonth (int m, int y) const
 The number if days in the given month and year in the Gregorian calendar.
std::string getDateString () const
 Date in human readable format, e.g.
const CalendarTimecalendarTime () const
 Calendar time: year,month,day hour,min,sec and ns.
int year () const
 Calendar time: year.
int month () const
 Calendar time: month.
int day () const
 Calendar time: day.
int hour () const
 Calendar time: hour.
int min () const
 Calendar time: min.
int sec () const
 Calendar time: sec.
int ns () const
 Calendar time: ns.
void operator+= (EVENT::long64 t)
 Add the specified number of ns to the time.

Static Public Member Functions

static bool test (int nDates)
 Tests the LCTime class with nDates random dates Returns true if successful - throws Exception in case of error.

Protected Member Functions

void convertToCalTime ()
void convertFromCalTime ()

Static Protected Attributes

static int dpm [13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 }

Detailed Description

Helper class that allows to convert time stamps as defined in LCEvent::getTimeStamp() ( ns since 1.1.1970 00:00:00 UTC) to ordinary date and time and vice versa.


Dates and times are in UTC/GMT by default.
Negative time stamps are not supported and mapped to 0LL and 1.1.1970 00:00:00 UTC respectively.

Author:
gaede
Version:
Id
LCTime.h,v 1.4 2005-04-22 15:39:01 gaede Exp

Constructor & Destructor Documentation

UTIL::LCTime::LCTime (  ) 

Init with current time ( accuracy depends on OS/machine,etc.

) in UTC/GMT.


Member Function Documentation

int UTIL::LCTime::daysInMonth ( int  m,
int  y 
) const

The number if days in the given month and year in the Gregorian calendar.

References isLeapYear().

Referenced by LCTime(), and test().

int UTIL::LCTime::daysInYear ( int  y  )  const

The number if days in the given year in the Gregorian calendar.

References isLeapYear().

std::string UTIL::LCTime::getDateString (  )  const

Date in human readable format, e.g.

10.02.2005 10:54:29.123456789 :
dd.mm.yyyy hh:mm:ss._ms_us_ns

Referenced by LCTime(), and test().


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Friends

Generated on 6 Mar 2020 for LCIO by  doxygen 1.6.1