Other api/dybdbi/timestamp

Previous topic

DybDbi.ContextRange

Next topic

DybDbi.ServiceMode

This Page

Daya Bay Links

Content Skeleton

DybDbi.TimeStamp

Underlying C++ class is defined in context:TimeStamp.h

class DybDbi.TimeStamp(unsigned int year, unsigned int month, unsigned int day, unsigned int hour, unsigned int min, unsigned int sec, unsigned int nsec=0, bool isUTC='true', int secOffset=0)

Bases: ROOT.ObjectProxy

Pythonic extensions to underlying DBI TimeStamp assume that all TimeStamps are expressing UTC times (this is the default)

In [2]: ts = TimeStamp.kNow()

In [3]: ts.UTCtoDatetime.ctime()
Out[3]: 'Thu May 26 13:10:20 2011'

In [4]: ts.UTCtoNaiveLocalDatetime.ctime()
Out[4]: 'Thu May 26 13:10:20 2011'

In [5]: ts.UTCtoDatetime
Out[5]: datetime.datetime(2011, 5, 26, 13, 10, 20, tzinfo=<DybDbi.TimeStampExt.UTC object at 0xbab5d6c>)

In [6]: ts.UTCtoNaiveLocalDatetime                   ## useful for comparisons with naive datetimes
Out[6]: datetime.datetime(2011, 5, 26, 13, 10, 20)

TimeStamp::TimeStamp() TimeStamp::TimeStamp(const TimeStamp& source) TimeStamp::TimeStamp(const timespec& ts) TimeStamp::TimeStamp(const time_t& t, const int nsec) TimeStamp::TimeStamp(unsigned int year, unsigned int month, unsigned int day, unsigned int hour, unsigned int min, unsigned int sec, unsigned int nsec = 0, bool isUTC = true, int secOffset = 0) TimeStamp::TimeStamp(unsigned int date, unsigned int time, unsigned int nsec, bool isUTC = true, int secOffset = 0) TimeStamp::TimeStamp(double seconds)

Add

void TimeStamp::Add(const TimeStamp& offset) void TimeStamp::Add(double seconds)

AsString

char* TimeStamp::AsString(char* option = “”)

CloneAndSubtract

TimeStamp TimeStamp::CloneAndSubtract(const TimeStamp& offset)

Copy

void TimeStamp::Copy(TimeStamp& vldts)

DumpTMStruct

static void TimeStamp::DumpTMStruct(const tm& tmstruct)

GetBOT

static TimeStamp TimeStamp::GetBOT()

GetDate

int TimeStamp::GetDate(bool inUTC = true, int secOffset = 0, unsigned int* year = 0, unsigned int* month = 0, unsigned int* day = 0)

GetEOT

static TimeStamp TimeStamp::GetEOT()

GetNBOT

static TimeStamp TimeStamp::GetNBOT()

GetNanoSec

int TimeStamp::GetNanoSec()

GetSec

long TimeStamp::GetSec()

GetSeconds

double TimeStamp::GetSeconds()

GetTime

int TimeStamp::GetTime(bool inUTC = true, int secOffset = 0, unsigned int* hour = 0, unsigned int* min = 0, unsigned int* sec = 0)

GetTimeSpec

timespec TimeStamp::GetTimeSpec()

GetZoneOffset

static int TimeStamp::GetZoneOffset()

IsA

TClass* TimeStamp::IsA()

IsLeapYear

static bool TimeStamp::IsLeapYear(int year)

IsNull

bool TimeStamp::IsNull()

MktimeFromUTC

static long TimeStamp::MktimeFromUTC(tm* tmstruct)

Print

void TimeStamp::Print(char* option = “”)

ShowMembers

void TimeStamp::ShowMembers(TMemberInspector&, char*)

Subtract

void TimeStamp::Subtract(const TimeStamp& offset) void TimeStamp::Subtract(double seconds)

UTCtoDatetime

From an assumed UTC TimeStamp return tz aware datetime

UTCtoNaiveLocalDatetime

From an assumed UTC TimeStamp return naive local datetime

ts = TimeStamp.kNow()
  'Thu, 26 May 2011 04:41:03 +0000 (GMT) +        0 nsec

ts.UTCtoDatetime.ctime()
  'Thu May 26 12:41:03 2011'

ts.UTCtoNaiveLocalDatetime.ctime()
  'Thu May 26 12:41:03 2011'
bot

static TimeStamp TimeStamp::GetBOT()

date

int TimeStamp::GetDate(bool inUTC = true, int secOffset = 0, unsigned int* year = 0, unsigned int* month = 0, unsigned int* day = 0)

eot

static TimeStamp TimeStamp::GetEOT()

classmethod kNow()

TimeStamp object representing current UTC time

nanosec

int TimeStamp::GetNanoSec()

nbot

static TimeStamp TimeStamp::GetNBOT()

sec

long TimeStamp::GetSec()

seconds

double TimeStamp::GetSeconds()

time

int TimeStamp::GetTime(bool inUTC = true, int secOffset = 0, unsigned int* hour = 0, unsigned int* min = 0, unsigned int* sec = 0)

timespec

timespec TimeStamp::GetTimeSpec()

zoneoffset

static int TimeStamp::GetZoneOffset()