library: libCore
#include "TDatime.h"


class description - header file - source file
viewCVS header - viewCVS source

class TDatime

Inheritance Inherited Members Includes Libraries
Class Charts

Function Members (Methods)

Display options:
Show inherited
Show non-public
TDatime(const TDatime& d)
TDatime(const char* sqlDateTime)
TDatime(UInt_t tloc, Bool_t dosDate = kFALSE)
TDatime(Int_t date, Int_t time)
TDatime(Int_t year, Int_t month, Int_t day, Int_t hour, Int_t min, Int_t sec)
const char*AsSQLString() const
const char*AsString() const
const char*AsString(char* out) const
static TClass*Class()
UInt_tConvert(Bool_t toGMT = kFALSE) const
voidCopy(TDatime& datime) const
voidFillBuffer(char*& buffer)
UInt_tGet() const
Int_tGetDate() const
static voidGetDateTime(UInt_t datetime, Int_t& date, Int_t& time)
Int_tGetDay() const
Int_tGetHour() const
Int_tGetMinute() const
Int_tGetMonth() const
Int_tGetSecond() const
Int_tGetTime() const
Int_tGetYear() const
virtual TClass*IsA() const
TDatime&operator=(const TDatime& d)
voidPrint(Option_t* option = "") const
voidReadBuffer(char*& buffer)
voidSet(UInt_t tloc, Bool_t dosDate = kFALSE)
voidSet(Int_t date, Int_t time)
voidSet(Int_t year, Int_t month, Int_t day, Int_t hour, Int_t min, Int_t sec)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
Int_tSizeof() const
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)

Data Members

UInt_tfDatimeDate (relative to 1995) + time

Class Description

 This class stores the date and time with a precision of one second   
 in an unsigned 32 bit word. The date is stored with the origin being 
 the 1st january 1995. See also class TStopwatch.                     

 Create a TDatime and set it to the current time.
TDatime(Int_t date, Int_t time)
 Create a TDatime and set it to the specified date and time.
 See Set(Int_t, Int_t) about the date, time format.
TDatime(Int_t year, Int_t month, Int_t day, Int_t hour, Int_t min, Int_t sec)
 Create a TDatime and set it to the specified year, month,
 day, time, hour, minute and second. See Set() about the format.
TDatime(const char *sqlDateTime)
 Expects as input a string in SQL date/time compatible format, like:
 yyyy-mm-dd hh:mm:ss.
const char * AsString()
 Return the date & time as a string (ctime() format).
 Copy result because it points to a statically allocated string.
const char * AsString(char *out)
 Return the date & time as a string (ctime() format).
 Result is copied into out (and out is returned). Make sure
 out can at least contain 26 characters. Thread safe.
const char * AsSQLString()
 Return the date & time in SQL compatible string format, like:
 1997-01-15 20:16:28. The returned string buffer is static and
 will be reused.
UInt_t Convert(Bool_t toGMT)
 Convert fDatime from TDatime format to the standard time_t format.
 If toGMT is true the returned time_t is converted to GMT.
void Copy(TDatime &datime)
 Copy this to datime.
void FillBuffer(char *&buffer)
 Encode Date/Time into buffer, used by I/O system.
Int_t GetDate()
 Return date in form of 19971224 (i.e. 24/12/1997)
Int_t GetTime()
 Return time in form of 123623 (i.e. 12:36:23)
void Print(Option_t *)
 Print date and time.
void ReadBuffer(char *&buffer)
 Decode Date/Time from output buffer, used by I/O system.
void Set()
 Set Date/Time to current time as reported by the system.
 Date and Time are encoded into one single unsigned 32 bit word.
 Date is stored with the origin being the 1st january 1995.
 Time has 1 second precision.
void Set(UInt_t tloc, Bool_t dosDate)
 The input arg is a time_t value returned by time() or a value
 returned by Convert(). This value is the number of seconds since
 the EPOCH (i.e. 00:00:00 on Jan 1m 1970). If dosDate is true then
 the input is a dosDate value.
void Set(Int_t date, Int_t time)
 Set date and time. Data must be in format 980418 or 19980418 and time in
 224512 (second precision). The date must
 be >= 950101.
 For years >= 2000, date can be given in the form 20001127 or 1001127
 internally the date will be converted to 1001127
void Set(Int_t year, Int_t month, Int_t day, Int_t hour, Int_t min, Int_t sec)
 Set date and time. Year may be xx where 95 <= xx <= 199 (199 being 2099).
 The year must be >= 1995.
void Streamer(TBuffer &b)
 Stream a object of type TDatime.
void GetDateTime(UInt_t datetime, Int_t &date, Int_t &time)
 Static function that returns the date and time. The input is
 in TDatime format (as obtained via TDatime::Get()).
 Date is returned in the format 950223  February 23 1995.
 Time is returned in the format 102459 10h 24m 59s.
TDatime& operator=(const TDatime &d)
{ fDatime = d.fDatime; return *this; }
TDatime(const TDatime &d)
{ }
virtual ~TDatime()
{ }
UInt_t Get()
{ return fDatime; }
Int_t GetYear()
{ return (fDatime>>26) + 1995; }
Int_t GetMonth()
{ return (fDatime<<6)>>28; }
Int_t GetDay()
{ return (fDatime<<10)>>27; }
Int_t GetHour()
{ return (fDatime<<15)>>27; }
Int_t GetMinute()
{ return (fDatime<<20)>>26; }
Int_t GetSecond()
{ return (fDatime<<26)>>26; }
Int_t Sizeof()
{return sizeof(UInt_t);}

Author: Rene Brun 05/01/95
Last update: root/base:$Name: $:$Id: TDatime.cxx,v 1.13 2006/12/13 18:06:34 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *

ROOT page - Class index - Class Hierarchy - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.