// @(#)root/base:$Id$
// Author: R. Hatcher   30/9/2001

/*************************************************************************
 * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

//////////////////////////////////////////////////////////////////////////
//
// The TTimeStamp encapsulates seconds and ns since EPOCH
//
// This extends (and isolates) struct timespec
//    struct timespec
//       {
//          time_t   tv_sec;   /* seconds */
//          long     tv_nsec;  /* nanoseconds */
//       }
//    time_t seconds is relative to Jan 1, 1970 00:00:00 UTC
//
// No accounting of leap seconds is made.
//
// Due to ROOT/CINT limitations TTimeStamp does not explicitly
// hold a timespec struct; attempting to do so means the Streamer
// must be hand written.  Instead we have chosen to simply contain
// similar fields within the private area of this class.
//
// NOTE: the use of time_t (and its default implementation as a 32 int)
//       implies overflow conditions occurs somewhere around
//       Jan 18, 19:14:07, 2038.
//       If this experiment is still going when it becomes significant
//       someone will have to deal with it.
//
//////////////////////////////////////////////////////////////////////////

#include "TTimeStamp.h"
#include "TString.h"
#include "TError.h"
#include "Riostream.h"
#ifdef R__WIN32
#include "Windows4Root.h"
#else
#include <unistd.h>
#include <sys/time.h>
#endif
#include "TVirtualMutex.h"

ClassImp(TTimeStamp);


TVirtualMutex *gTimeMutex = 0; // local mutex

//______________________________________________________________________________
std::ostream& operator<<(std::ostream& os, const TTimeStamp& ts)
{
   // Write time stamp to std::ostream.

   if (os.good()) {
      if (os.tie()) os.tie()->flush(); // instead of opfx
      os << ts.AsString("c");
   }
   // instead of os.osfx()
   if (os.flags() & std::ios::unitbuf) os.flush();
   return os;
}

//______________________________________________________________________________
TBuffer &operator>>(TBuffer &buf, TTimeStamp &ts)
{
   // Read time stamp from TBuffer.

   ts.Streamer(buf);
   return buf;
}

//______________________________________________________________________________
TBuffer &operator<<(TBuffer &buf, const TTimeStamp &ts)
{
   // Write time stamp to TBuffer.

   ((TTimeStamp&)ts).Streamer(buf);
   return buf;
}

//______________________________________________________________________________
TTimeStamp::TTimeStamp()
{
   // Default ctor. Create a TTimeStamp and set it to the current time
   // (as best possible). The nanosecond part is faked so that subsequenct
   // calls simply add 1 to ensure that sequential calls are distinct
   // (and sortable).

   Set();
}

//______________________________________________________________________________
TTimeStamp::TTimeStamp(UInt_t year, UInt_t month,
                       UInt_t day,  UInt_t hour,
                       UInt_t min,  UInt_t sec,
                       UInt_t nsec,
                       Bool_t isUTC, Int_t secOffset)
{
   // Create a TTimeStamp and set it to the specified year, month,
   // day, time, hour, minute, second and nanosec.
   // If !isUTC then it is assumed to be the standard local time zone.
   //
   // If local time is PST then one can use
   //    TTimeStamp(year,month,day,hour,min,sec,nsec,kFALSE,0);
   // or
   //    Int_t secOffset = 8*60*60;
   //    TTimeStamp(year,month,day,hour,min,sec,nsec,kTRUE,8*60*60);

   Set(year, month, day, hour, min, sec, nsec, isUTC, secOffset);
}

//______________________________________________________________________________
TTimeStamp::TTimeStamp(UInt_t date, UInt_t time,
                       UInt_t nsec,
                       Bool_t isUTC, Int_t secOffset)
{
   // Create a TTimeStamp and set it to the specified date, time, nanosec.
   // If !isUTC then it is assumed to be the standard local time zone.

   Set(date, time, nsec, isUTC, secOffset);
}

//______________________________________________________________________________
TTimeStamp::TTimeStamp(UInt_t tloc, Bool_t isUTC, Int_t secOffset, Bool_t dosDate)
{
   // Create a TTimeStamp and set it to tloc which must be a time_t value
   // returned by time(). 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.

   Set(tloc, isUTC, secOffset, dosDate);
}

//______________________________________________________________________________
const Char_t *TTimeStamp::AsString(Option_t *option) const
{
   // Return the date & time as a string.
   //
   // Result is pointer to a statically allocated string.
   // User should copy this into their own buffer before calling
   // this method again.
   //
   // Option "l" returns it in local zone format
   // (can be applied to default or compact format).
   //
   // Default format is RFC822 compliant:
   //   "Mon, 02 Jan 2001 18:11:12 +0000 (GMT) +999999999 nsec"
   //   "Mon, 02 Jan 2001 10:11:12 -0800 (PST) +999999999 nsec"
   //
   // Option "c" compact is (almost) ISO 8601 compliant:
   //   "2001-01-02 18:11:12.9999999999Z"
   //   "2001-01-02 10:11:12.9999999999-0800"  if PST
   //      * uses "-" as date separator as specified in ISO 8601
   //      * uses "." rather than preferred "," for decimal separator
   //      * -HHMM is the difference between local and UTC (if behind, + if ahead).
   //   The "-HHMM" is replaced with "Z" if given as UTC.
   //   To be strictly conforming it should use "T" instead of the
   //   blank separating the date and time.
   //
   // Option "2" returns as {sec,nsec} integers.
   //
   // Option "s" returns "2001-01-02 18:11:12" with an implied UTC,
   // overrides "l" option.
   //
   // Internally uses a circular list of buffers to avoid problems
   // using AsString multiple times in a single statement.

   const Int_t nbuffers = 8;     // # of buffers

   static Char_t formatted[nbuffers][64];  // strftime fields substituted
   static Char_t formatted2[nbuffers][64]; // nanosec field substituted

   static Int_t ibuffer = nbuffers;

   R__LOCKGUARD2(gTimeMutex);

   ibuffer = (ibuffer+1)%nbuffers; // each call moves to next buffer

   TString opt = option;
   opt.ToLower();

   if (opt.Contains("2")) {
      // return string formatted as integer {sec,nsec}
      sprintf(formatted[ibuffer], "{%d,%d}", fSec, fNanoSec);
      return formatted[ibuffer];
   }

#ifdef R__LINUX
   // under linux %z is the hour offset and %Z is the timezone name
   const Char_t *kRFC822   = "%a, %d %b %Y %H:%M:%S %z (%Z) +#9ld nsec";
   const Char_t *kISO8601  = "%Y-%m-%d %H:%M:%S.#9.9ld%z";
   const Char_t *kISO8601Z = "%Y-%m-%d %H:%M:%S.#9.9ldZ";
#else
   // otherwise only %Z is guarenteed to be defind
   const Char_t *kRFC822   = "%a, %d %b %Y %H:%M:%S %Z +#9ld nsec";
   const Char_t *kISO8601  = "%Y-%m-%d %H:%M:%S.#9.9ld%Z";
   const Char_t *kISO8601Z = "%Y-%m-%d %H:%M:%S.#9.9ldZ";
#endif
   const Char_t *kSQL = "%Y-%m-%d %H:%M:%S";

   Bool_t asLocal = opt.Contains("l");
   Bool_t asSQL   = opt.Contains("s");
   if (asSQL) asLocal = kFALSE;

   const Char_t *format = kRFC822;
   if (opt.Contains("c")) {
      format = kISO8601;
      if (!asLocal) format = kISO8601Z;
   }
   if (asSQL) format = kSQL;

   // get the components into a tm struct
   time_t seconds = (time_t) fSec;
#ifdef _REENTRANT
   struct tm buf;
   struct tm *ptm = (asLocal) ? localtime_r(&seconds, &buf) : gmtime_r(&seconds, &buf);
#else
   struct tm *ptm = (asLocal) ? localtime(&seconds) : gmtime(&seconds);
#endif

   // format all but the nsec field
   // size_t length =
   strftime(formatted[ibuffer], sizeof(formatted[ibuffer]), format, ptm);

   if (asSQL) return formatted[ibuffer];

   // hack in the nsec part
   Char_t *ptr = strrchr(formatted[ibuffer], '#');
   if (ptr) *ptr = '%';    // substitute % for #
   sprintf(formatted2[ibuffer], formatted[ibuffer], fNanoSec);

   return formatted2[ibuffer];
}

//______________________________________________________________________________
void TTimeStamp::Copy(TTimeStamp &ts) const
{
   // Copy this to ts.

   ts.fSec     = fSec;
   ts.fNanoSec = fNanoSec;
}

//______________________________________________________________________________
UInt_t TTimeStamp::GetDate(Bool_t inUTC, Int_t secOffset,
                           UInt_t *year, UInt_t *month, UInt_t *day) const
{
   // Return date in form of 19971224 (i.e. 24/12/1997),
   // if non-zero pointers supplied for year, month, day fill those as well.

   time_t atime = fSec + secOffset;
#ifdef _REENTRANT
   struct tm buf;
   struct tm *ptm = (inUTC) ? gmtime_r(&atime, &buf) : localtime_r(&atime, &buf);
#else
   struct tm *ptm = (inUTC) ? gmtime(&atime) : localtime(&atime);
#endif

   if (day)   *day   = ptm->tm_mday;
   if (month) *month = ptm->tm_mon + 1;
   if (year)  *year  = ptm->tm_year + 1900;

   return (1900+ptm->tm_year)*10000 + (1+ptm->tm_mon)*100 + ptm->tm_mday;
}

//______________________________________________________________________________
UInt_t TTimeStamp::GetTime(Bool_t inUTC, Int_t secOffset,
                           UInt_t *hour, UInt_t *min, UInt_t *sec) const
{
   // Return time in form of 123623 (i.e. 12:36:23),
   // if non-zero pointers supplied for hour, min, sec fill those as well.

   time_t atime = fSec + secOffset;
#ifdef _REENTRANT
   struct tm buf;
   struct tm *ptm = (inUTC) ? gmtime_r(&atime, &buf) : localtime_r(&atime, &buf);
#else
   struct tm *ptm = (inUTC) ? gmtime(&atime) : localtime(&atime);
#endif

   if (hour) *hour = ptm->tm_hour;
   if (min)  *min  = ptm->tm_min;
   if (sec)  *sec  = ptm->tm_sec;

   return ptm->tm_hour*10000 + ptm->tm_min*100 + ptm->tm_sec;
}

//______________________________________________________________________________
Int_t TTimeStamp::GetDayOfYear(Bool_t inUTC, Int_t secOffset) const
{
   // Get the day of the year represented by this time stamp value.
   // Valid return values range between 1 and 366, where January 1 = 1.

   time_t atime = fSec + secOffset;
#ifdef _REENTRANT
   struct tm buf;
   struct tm *ptm = (inUTC) ? gmtime_r(&atime, &buf) : localtime_r(&atime, &buf);
#else
   struct tm *ptm = (inUTC) ? gmtime(&atime) : localtime(&atime);
#endif

   Int_t day   = ptm->tm_mday;
   Int_t month = ptm->tm_mon + 1;
   Int_t year  = ptm->tm_year + 1900;

   return GetDayOfYear(day, month, year);
}

//______________________________________________________________________________
Int_t TTimeStamp::GetDayOfWeek(Bool_t inUTC, Int_t secOffset) const
{
   // Method is using Zeller's formula for calculating the day number.
   // Valid return values range between 1 and 7, where Monday = 1.

   time_t atime = fSec + secOffset;
#ifdef _REENTRANT
   struct tm buf;
   struct tm *ptm = (inUTC) ? gmtime_r(&atime, &buf) : localtime_r(&atime, &buf);
#else
   struct tm *ptm = (inUTC) ? gmtime(&atime) : localtime(&atime);
#endif

   Int_t day   = ptm->tm_mday;
   Int_t month = ptm->tm_mon + 1;
   Int_t year  = ptm->tm_year + 1900;

   return GetDayOfWeek(day, month, year);
}

//______________________________________________________________________________
Int_t TTimeStamp::GetMonth(Bool_t inUTC, Int_t secOffset) const
{
   // Get the month of the year. Valid return values are between 1 and 12.

   time_t atime = fSec + secOffset;
#ifdef _REENTRANT
   struct tm buf;
   struct tm *ptm = (inUTC) ? gmtime_r(&atime, &buf) : localtime_r(&atime, &buf);
#else
   struct tm *ptm = (inUTC) ? gmtime(&atime) : localtime(&atime);
#endif

   return ptm->tm_mon + 1;
}

//______________________________________________________________________________
Int_t TTimeStamp::GetWeek(Bool_t inUTC, Int_t secOffset) const
{
   // Get the week of the year. Valid week values are between 1 and 53.
   // The return value is the year*100+week (1 Jan may be in the last
   // week of the previous year so the year must be returned too).

   time_t atime = fSec + secOffset;
#ifdef _REENTRANT
   struct tm buf;
   struct tm *ptm = (inUTC) ? gmtime_r(&atime, &buf) : localtime_r(&atime, &buf);
#else
   struct tm *ptm = (inUTC) ? gmtime(&atime) : localtime(&atime);
#endif

   Int_t day   = ptm->tm_mday;
   Int_t month = ptm->tm_mon + 1;
   Int_t year  = ptm->tm_year + 1900;

   return GetWeek(day, month, year);
}

//______________________________________________________________________________
Bool_t TTimeStamp::IsLeapYear(Bool_t inUTC, Int_t secOffset) const
{
   // Is the year a leap year.
   // The calendar year is 365 days long, unless the year is exactly divisible
   // by 4, in which case an extra day is added to February to make the year
   // 366 days long. If the year is the last year of a century, eg. 1700, 1800,
   // 1900, 2000, then it is only a leap year if it is exactly divisible by
   // 400. Therefore, 1900 wasn't a leap year but 2000 was. The reason for
   // these rules is to bring the average length of the calendar year into
   // line with the length of the Earth's orbit around the Sun, so that the
   // seasons always occur during the same months each year.

   time_t atime = fSec + secOffset;
#ifdef _REENTRANT
   struct tm buf;
   struct tm *ptm = (inUTC) ? gmtime_r(&atime, &buf) : localtime_r(&atime, &buf);
#else
   struct tm *ptm = (inUTC) ? gmtime(&atime) : localtime(&atime);
#endif

   Int_t year = ptm->tm_year + 1900;

   return IsLeapYear(year);
}

//______________________________________________________________________________
Int_t TTimeStamp::GetZoneOffset()
{
   // Static method returning local (current) time zone offset from UTC.
   // This is the value in seconds one must add to the local time to arrive at
   // Coordinated Universal Time, so it is negative east of the Prime Meridian.

   // ?? should tzset (_tzset) be called?
#ifndef R__WIN32
   tzset();
#if defined(R__WINGCC)
   return _timezone;
#else
#if !defined(R__FBSD) && !defined(R__OBSD)
   return  timezone;   // unix has extern long int
#else	 
   time_t tp = 0;	 
   time(&tp);	 
#ifdef _REENTRANT	 
   struct tm buf;	 
   return -localtime_r(&tp, &buf)->tm_gmtoff;	 
#else	 
   return -localtime(&tp)->tm_gmtoff;	 
#endif	 
#endif  
#endif
#else
   _tzset();
   return _timezone;   // Win32 prepends "_"
#endif
}

//______________________________________________________________________________
void TTimeStamp::Add(const TTimeStamp &offset)
{
   // Add "offset" as a delta time.

   fSec     += offset.fSec;
   fNanoSec += offset.fNanoSec;
   NormalizeNanoSec();
}

//______________________________________________________________________________
void TTimeStamp::Print(Option_t *option) const
{
   // Print date and time.

   printf("Date/Time = %s\n", AsString(option));
}

//______________________________________________________________________________
void TTimeStamp::Set()
{
   // Set Date/Time to current time as reported by the system.
   // No accounting for nanoseconds with std ANSI functions,
   // ns part faked so that subsequent calls simply add 1 to it
   // this ensures that calls within the same second come back
   // distinct (and sortable). Time is since Jan 1, 1970.

#ifdef R__WIN32
   ULARGE_INTEGER time;
   GetSystemTimeAsFileTime((FILETIME *)&time);
   // NT keeps time in FILETIME format which is 100ns ticks since
   // Jan 1, 1601. TTimeStamp uses time in 100ns ticks since Jan 1, 1970,
   // the difference is 134774 days.
   fNanoSec = Int_t((time.QuadPart * (unsigned __int64) 100) %
                    (unsigned __int64) 1000000000);
   time.QuadPart -=
            (unsigned __int64) (1000*1000*10)       // seconds
          * (unsigned __int64) (60 * 60 * 24)       // days
          * (unsigned __int64) (134774);            // # of days

   fSec     = Int_t(time.QuadPart/(unsigned __int64) (1000*1000*10));
#else
   struct timeval tp;
   gettimeofday(&tp, 0);
   fSec     = tp.tv_sec;
   fNanoSec = tp.tv_usec*1000;
#endif

   static Int_t sec = 0, nsec = 0, fake_ns = 0;

   R__LOCKGUARD2(gTimeMutex);

   if (fSec == sec && fNanoSec == nsec)
      fNanoSec += ++fake_ns;
   else {
      fake_ns = 0;
      sec     = fSec;
      nsec    = fNanoSec;
   }
}

//______________________________________________________________________________
void TTimeStamp::Set(Int_t year, Int_t month, Int_t day,
                     Int_t hour, Int_t min, Int_t sec,
                     Int_t nsec, Bool_t isUTC, Int_t secOffset)
{
   // Set Date/Time from components.
   //
   // Month & day both use normal 1..12 and 1..31 counting,
   // hours, min, sec run from 0 to 23, 59, 59 respectively,
   // secOffset provides method for adjusting for alternative timezones
   //
   // "year"  |    0    1 ... 37 | 38...69   |   70 .. 100  101 ..  137
   // true    | 2000 2001   2037 | undefined | 1970   2000 2001 .. 2037
   //
   // "year"  | 138...1969 | 1970 .. 2037 | ...
   // true    | undefined  | 1970 .. 2037 | undefined
   //

   // deal with special formats of year
   if (year <= 37)                year += 2000;
   if (year >= 70 && year <= 137) year += 1900;
   // tm.tm_year is years since 1900
   if (year >= 1900)              year -= 1900;

   struct tm tmstruct;
   tmstruct.tm_year  = year;    // years since 1900
   tmstruct.tm_mon   = month-1; // months since Jan [0,11]
   tmstruct.tm_mday  = day;     // day of the month [1,31]
   tmstruct.tm_hour  = hour;    // hours since midnight [0,23]
   tmstruct.tm_min   = min;     // minutes after the hour [0,59]
   tmstruct.tm_sec   = sec + secOffset;  // seconds after the minute [0,59]
   tmstruct.tm_isdst = -1;     // let "mktime" determine DST setting

   const time_t bad_time_t = (time_t) -1;
   // convert tm struct to time_t, if values are given in UTC then
   // no standard routine exists and we'll have to use our homegrown routine,
   // if values are given in local time then use "mktime"
   // which also normalizes the tm struct as a byproduct
   time_t utc_sec = (isUTC) ? MktimeFromUTC(&tmstruct) : mktime(&tmstruct);

   if (utc_sec == bad_time_t)
      Error("TTimeStamp::Set","mktime returned -1");

   fSec     = utc_sec;
   fNanoSec = nsec;

   NormalizeNanoSec();
}

//______________________________________________________________________________
void TTimeStamp::Set(Int_t date, Int_t time, Int_t nsec,
                     Bool_t isUTC, Int_t secOffset)
{
   // Set date/time from integers of the form [yy]YYMMDD and HHMMSS,
   // assume UTC (UTC) components:
   //
   //  MM: 01=January .. 12=December
   //  DD: 01 .. 31
   //
   //  HH: 00=midnight .. 23
   //  MM: 00 .. 59
   //  SS: 00 .. 69
   //
   // Date must be in format 980418 or 19980418
   //                       1001127 or 20001127  (i.e. year 100 = 2000),
   // time must be in format 224512 (second precision),
   // date must be >= 700101.

   Int_t year  = date/10000;
   Int_t month = (date-year*10000)/100;
   Int_t day   = date%100;

   // protect against odd attempts at time offsets
   const Int_t oneday = 240000;
   while (time < 0) {
      time += oneday;
      day  -= 1;
   }
   while (time > oneday) {
      time -= oneday;
      day  += 1;
   }
   Int_t hour  = time/10000;
   Int_t min   = (time-hour*10000)/100;
   Int_t sec   = time%100;

   Set(year, month, day, hour, min, sec, nsec, isUTC, secOffset);
}

//______________________________________________________________________________
void TTimeStamp::Set(UInt_t tloc, Bool_t isUTC, Int_t secOffset, 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.

   struct tm localtm;
   memset (&localtm, 0, sizeof (localtm));

   if (dosDate) {
      localtm.tm_year  = ((tloc >> 25) & 0x7f) + 80;
      localtm.tm_mon   = ((tloc >> 21) & 0xf);
      localtm.tm_mday  = (tloc >> 16) & 0x1f;
      localtm.tm_hour  = (tloc >> 11) & 0x1f;
      localtm.tm_min   = (tloc >> 5) & 0x3f;
      localtm.tm_sec   = (tloc & 0x1f) * 2 + secOffset;
      localtm.tm_isdst = -1;
   } else {
      time_t t = (time_t) tloc;
#ifdef _REENTRANT
      struct tm tpa;
      struct tm *tp = localtime_r(&t, &tpa);
#else
      struct tm *tp = localtime(&t);
#endif
      localtm.tm_year  = tp->tm_year;
      localtm.tm_mon   = tp->tm_mon;
      localtm.tm_mday  = tp->tm_mday;
      localtm.tm_hour  = tp->tm_hour;
      localtm.tm_min   = tp->tm_min;
      localtm.tm_sec   = tp->tm_sec + secOffset;
      localtm.tm_isdst = -1;
   }

   const time_t bad_time_t = (time_t) -1;
   // convert tm struct to time_t, if values are given in UTC then
   // no standard routine exists and we'll have to use our homegrown routine,
   // if values are given in local time then use "mktime"
   // which also normalizes the tm struct as a byproduct
   time_t utc_sec = (isUTC && dosDate) ? MktimeFromUTC(&localtm) : mktime(&localtm);

   if (utc_sec == bad_time_t)
      Error("TTimeStamp::Set","mktime returned -1");

   fSec     = utc_sec;
   fNanoSec = 0;  //nsec;

   NormalizeNanoSec();
}

//______________________________________________________________________________
void TTimeStamp::NormalizeNanoSec()
{
   // Ensure that the fNanoSec field is in range [0,99999999].

   const Int_t kNsPerSec = 1000000000;
   // deal with negative values
   while (fNanoSec < 0) {
      fNanoSec += kNsPerSec;
      fSec -= 1;
   }

   // deal with values inf fNanoSec greater than one sec
   while (fNanoSec >= kNsPerSec) {
      fNanoSec -= kNsPerSec;
      fSec += 1;
   }
}

//______________________________________________________________________________
time_t TTimeStamp::MktimeFromUTC(tm_t *tmstruct)
{
   // Equivalent of standard routine "mktime" but
   // using the assumption that tm struct is filled with UTC, not local, time.
   //
   // This version *ISN'T* configured to handle every possible
   // weirdness of out-of-range values in the case of normalizing
   // the tm struct.
   //
   // This version *DOESN'T* correctly handle values that can't be
   // fit into a time_t (i.e. beyond year 2038-01-18 19:14:07, or
   // before the start of Epoch).

   Int_t daysInMonth[] = { 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
   Int_t year = tmstruct->tm_year + 1900;
   daysInMonth[1] = IsLeapYear(year) ? 29 : 28;

   // fill in tmstruct->tm_yday

   Int_t &ref_tm_mon = tmstruct->tm_mon;
   Int_t &ref_tm_mday = tmstruct->tm_mday;
   // count days in months past
   tmstruct->tm_yday = 0;
   for (Int_t imonth = 0; imonth < ref_tm_mon; imonth++) {
      tmstruct->tm_yday += daysInMonth[imonth];
   }
   tmstruct->tm_yday += ref_tm_mday - 1;  // day [1-31] but yday [0-365]

   // adjust if day in this month is more than the month has
   while (ref_tm_mday > daysInMonth[ref_tm_mon]) {
      ref_tm_mday -= daysInMonth[ref_tm_mon];
      ref_tm_mon++;
   }

   // *should* calculate tm_wday (0-6) here ...

   // UTC is never DST
   tmstruct->tm_isdst = 0;

   // Calculate seconds since the Epoch based on formula in
   // POSIX  IEEEE Std 1003.1b-1993 pg 22

   Int_t utc_sec = tmstruct->tm_sec +
                   tmstruct->tm_min*60 +
                   tmstruct->tm_hour*3600 +
                   tmstruct->tm_yday*86400 +
                   (tmstruct->tm_year-70)*31536000 +
                   ((tmstruct->tm_year-69)/4)*86400;

   return utc_sec;
}

//______________________________________________________________________________
Int_t TTimeStamp::GetDayOfYear(Int_t day, Int_t month, Int_t year)
{
   // Get the day of the year represented by day, month and year.
   // Valid return values range between 1 and 366, where January 1 = 1.

   Int_t dayOfYear = 0;
   Int_t daysInMonth[] = { 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
   daysInMonth[1] = IsLeapYear(year) ? 29 : 28;

   for (Int_t i = 0; i < (month - 1); i++)
      dayOfYear += daysInMonth[i];
   dayOfYear += day;

   return dayOfYear;
}

//______________________________________________________________________________
Int_t TTimeStamp::GetDayOfWeek(Int_t day, Int_t month, Int_t year)
{
   // Method is using Zeller's formula for calculating the day number.
   // Valid return values range between 1 and 7, where Monday = 1.

   Int_t dayno;

   if (month < 3) {
      year--;
      month += 12;
   }

   dayno = 1 + day + 2*month + 3*(month + 1)/5 + year + year/4 - year/100 + year/400;
   dayno %= 7;

   // make monday first day of week
   return ((dayno == 0) ? 7 : dayno);
}

//______________________________________________________________________________
Int_t TTimeStamp::GetWeek(Int_t day, Int_t month, Int_t year)
{
   // Get the week of the year. Valid week values are between 1 and 53.
   // The return value is the year*100+week (1 Jan may be in the last
   // week of the previous year so the year must be returned too).

   Int_t dayOfYear = GetDayOfYear(day, month, year);
   Int_t dayJan1st = GetDayOfWeek(1, 1, year);
   Int_t week = (dayOfYear + dayJan1st - 2) / 7 + 1;

   if (dayJan1st > 4)
      week--;

   if (week == 53) {
      Int_t dayNextJan1st = GetDayOfWeek(1, 1, year + 1);
      if (dayNextJan1st > 1 && dayNextJan1st < 5) {
         year++;
         week = 1;
      }
   } else if (week == 0) {
      Int_t dayPrevJan1st = GetDayOfWeek(1, 1, year - 1);
      week = (dayPrevJan1st < 5 && dayJan1st > 4) ? 53 : 52;
      year--;
   }
   return year * 100 + week;
}

//______________________________________________________________________________
Bool_t TTimeStamp::IsLeapYear(Int_t year)
{
   // Is the given year a leap year.
   // The calendar year is 365 days long, unless the year is exactly divisible
   // by 4, in which case an extra day is added to February to make the year
   // 366 days long. If the year is the last year of a century, eg. 1700, 1800,
   // 1900, 2000, then it is only a leap year if it is exactly divisible by
   // 400. Therefore, 1900 wasn't a leap year but 2000 was. The reason for
   // these rules is to bring the average length of the calendar year into
   // line with the length of the Earth's orbit around the Sun, so that the
   // seasons always occur during the same months each year.

   return (year % 4 == 0) && !((year % 100 == 0) && (year % 400 > 0));
}

//______________________________________________________________________________
void TTimeStamp::DumpTMStruct(const tm_t &tmstruct)
{
   // Print out the "tm" structure:
   // tmstruct.tm_year = year;    // years since 1900
   // tmstruct.tm_mon  = month-1; // months since Jan [0,11]
   // tmstruct.tm_mday = day;     // day of the month [1,31]
   // tmstruct.tm_hour = hour;    // hours since midnight [0,23]
   // tmstruct.tm_min  = min;     // minutes after the hour [0,59]
   // tmstruct.tm_sec  = sec;     // seconds after the minute [0,59]
   // tmstruct.tm_wday            // day of week [0,6]
   // tmstruct.tm_yday            // days in year [0,365]
   // tmstruct.tm_isdst           // DST [-1/0/1]  (unknown,false,true)

   printf(" tm { year %4d, mon   %2d, day   %2d,\n",
          tmstruct.tm_year,
          tmstruct.tm_mon,
          tmstruct.tm_mday);
   printf("      hour   %2d, min   %2d, sec   %2d,\n",
          tmstruct.tm_hour,
          tmstruct.tm_min,
          tmstruct.tm_sec);
   printf("      wday   %2d, yday %3d, isdst %2d",
          tmstruct.tm_wday,
          tmstruct.tm_yday,
          tmstruct.tm_isdst);
#if (defined(linux) && !defined(R__WINGCC)) || defined(R__MACOSX)
   printf(",\n      tm_gmtoff %6ld, tm_zone \"%s\"",
#if defined(__USE_BSD) || defined(R__MACOSX)
   tmstruct.tm_gmtoff, tmstruct.tm_zone);
#else
   tmstruct.__tm_gmtoff, tmstruct.__tm_zone);
#endif
#endif
   printf(" }\n");
}
 TTimeStamp.cxx:1
 TTimeStamp.cxx:2
 TTimeStamp.cxx:3
 TTimeStamp.cxx:4
 TTimeStamp.cxx:5
 TTimeStamp.cxx:6
 TTimeStamp.cxx:7
 TTimeStamp.cxx:8
 TTimeStamp.cxx:9
 TTimeStamp.cxx:10
 TTimeStamp.cxx:11
 TTimeStamp.cxx:12
 TTimeStamp.cxx:13
 TTimeStamp.cxx:14
 TTimeStamp.cxx:15
 TTimeStamp.cxx:16
 TTimeStamp.cxx:17
 TTimeStamp.cxx:18
 TTimeStamp.cxx:19
 TTimeStamp.cxx:20
 TTimeStamp.cxx:21
 TTimeStamp.cxx:22
 TTimeStamp.cxx:23
 TTimeStamp.cxx:24
 TTimeStamp.cxx:25
 TTimeStamp.cxx:26
 TTimeStamp.cxx:27
 TTimeStamp.cxx:28
 TTimeStamp.cxx:29
 TTimeStamp.cxx:30
 TTimeStamp.cxx:31
 TTimeStamp.cxx:32
 TTimeStamp.cxx:33
 TTimeStamp.cxx:34
 TTimeStamp.cxx:35
 TTimeStamp.cxx:36
 TTimeStamp.cxx:37
 TTimeStamp.cxx:38
 TTimeStamp.cxx:39
 TTimeStamp.cxx:40
 TTimeStamp.cxx:41
 TTimeStamp.cxx:42
 TTimeStamp.cxx:43
 TTimeStamp.cxx:44
 TTimeStamp.cxx:45
 TTimeStamp.cxx:46
 TTimeStamp.cxx:47
 TTimeStamp.cxx:48
 TTimeStamp.cxx:49
 TTimeStamp.cxx:50
 TTimeStamp.cxx:51
 TTimeStamp.cxx:52
 TTimeStamp.cxx:53
 TTimeStamp.cxx:54
 TTimeStamp.cxx:55
 TTimeStamp.cxx:56
 TTimeStamp.cxx:57
 TTimeStamp.cxx:58
 TTimeStamp.cxx:59
 TTimeStamp.cxx:60
 TTimeStamp.cxx:61
 TTimeStamp.cxx:62
 TTimeStamp.cxx:63
 TTimeStamp.cxx:64
 TTimeStamp.cxx:65
 TTimeStamp.cxx:66
 TTimeStamp.cxx:67
 TTimeStamp.cxx:68
 TTimeStamp.cxx:69
 TTimeStamp.cxx:70
 TTimeStamp.cxx:71
 TTimeStamp.cxx:72
 TTimeStamp.cxx:73
 TTimeStamp.cxx:74
 TTimeStamp.cxx:75
 TTimeStamp.cxx:76
 TTimeStamp.cxx:77
 TTimeStamp.cxx:78
 TTimeStamp.cxx:79
 TTimeStamp.cxx:80
 TTimeStamp.cxx:81
 TTimeStamp.cxx:82
 TTimeStamp.cxx:83
 TTimeStamp.cxx:84
 TTimeStamp.cxx:85
 TTimeStamp.cxx:86
 TTimeStamp.cxx:87
 TTimeStamp.cxx:88
 TTimeStamp.cxx:89
 TTimeStamp.cxx:90
 TTimeStamp.cxx:91
 TTimeStamp.cxx:92
 TTimeStamp.cxx:93
 TTimeStamp.cxx:94
 TTimeStamp.cxx:95
 TTimeStamp.cxx:96
 TTimeStamp.cxx:97
 TTimeStamp.cxx:98
 TTimeStamp.cxx:99
 TTimeStamp.cxx:100
 TTimeStamp.cxx:101
 TTimeStamp.cxx:102
 TTimeStamp.cxx:103
 TTimeStamp.cxx:104
 TTimeStamp.cxx:105
 TTimeStamp.cxx:106
 TTimeStamp.cxx:107
 TTimeStamp.cxx:108
 TTimeStamp.cxx:109
 TTimeStamp.cxx:110
 TTimeStamp.cxx:111
 TTimeStamp.cxx:112
 TTimeStamp.cxx:113
 TTimeStamp.cxx:114
 TTimeStamp.cxx:115
 TTimeStamp.cxx:116
 TTimeStamp.cxx:117
 TTimeStamp.cxx:118
 TTimeStamp.cxx:119
 TTimeStamp.cxx:120
 TTimeStamp.cxx:121
 TTimeStamp.cxx:122
 TTimeStamp.cxx:123
 TTimeStamp.cxx:124
 TTimeStamp.cxx:125
 TTimeStamp.cxx:126
 TTimeStamp.cxx:127
 TTimeStamp.cxx:128
 TTimeStamp.cxx:129
 TTimeStamp.cxx:130
 TTimeStamp.cxx:131
 TTimeStamp.cxx:132
 TTimeStamp.cxx:133
 TTimeStamp.cxx:134
 TTimeStamp.cxx:135
 TTimeStamp.cxx:136
 TTimeStamp.cxx:137
 TTimeStamp.cxx:138
 TTimeStamp.cxx:139
 TTimeStamp.cxx:140
 TTimeStamp.cxx:141
 TTimeStamp.cxx:142
 TTimeStamp.cxx:143
 TTimeStamp.cxx:144
 TTimeStamp.cxx:145
 TTimeStamp.cxx:146
 TTimeStamp.cxx:147
 TTimeStamp.cxx:148
 TTimeStamp.cxx:149
 TTimeStamp.cxx:150
 TTimeStamp.cxx:151
 TTimeStamp.cxx:152
 TTimeStamp.cxx:153
 TTimeStamp.cxx:154
 TTimeStamp.cxx:155
 TTimeStamp.cxx:156
 TTimeStamp.cxx:157
 TTimeStamp.cxx:158
 TTimeStamp.cxx:159
 TTimeStamp.cxx:160
 TTimeStamp.cxx:161
 TTimeStamp.cxx:162
 TTimeStamp.cxx:163
 TTimeStamp.cxx:164
 TTimeStamp.cxx:165
 TTimeStamp.cxx:166
 TTimeStamp.cxx:167
 TTimeStamp.cxx:168
 TTimeStamp.cxx:169
 TTimeStamp.cxx:170
 TTimeStamp.cxx:171
 TTimeStamp.cxx:172
 TTimeStamp.cxx:173
 TTimeStamp.cxx:174
 TTimeStamp.cxx:175
 TTimeStamp.cxx:176
 TTimeStamp.cxx:177
 TTimeStamp.cxx:178
 TTimeStamp.cxx:179
 TTimeStamp.cxx:180
 TTimeStamp.cxx:181
 TTimeStamp.cxx:182
 TTimeStamp.cxx:183
 TTimeStamp.cxx:184
 TTimeStamp.cxx:185
 TTimeStamp.cxx:186
 TTimeStamp.cxx:187
 TTimeStamp.cxx:188
 TTimeStamp.cxx:189
 TTimeStamp.cxx:190
 TTimeStamp.cxx:191
 TTimeStamp.cxx:192
 TTimeStamp.cxx:193
 TTimeStamp.cxx:194
 TTimeStamp.cxx:195
 TTimeStamp.cxx:196
 TTimeStamp.cxx:197
 TTimeStamp.cxx:198
 TTimeStamp.cxx:199
 TTimeStamp.cxx:200
 TTimeStamp.cxx:201
 TTimeStamp.cxx:202
 TTimeStamp.cxx:203
 TTimeStamp.cxx:204
 TTimeStamp.cxx:205
 TTimeStamp.cxx:206
 TTimeStamp.cxx:207
 TTimeStamp.cxx:208
 TTimeStamp.cxx:209
 TTimeStamp.cxx:210
 TTimeStamp.cxx:211
 TTimeStamp.cxx:212
 TTimeStamp.cxx:213
 TTimeStamp.cxx:214
 TTimeStamp.cxx:215
 TTimeStamp.cxx:216
 TTimeStamp.cxx:217
 TTimeStamp.cxx:218
 TTimeStamp.cxx:219
 TTimeStamp.cxx:220
 TTimeStamp.cxx:221
 TTimeStamp.cxx:222
 TTimeStamp.cxx:223
 TTimeStamp.cxx:224
 TTimeStamp.cxx:225
 TTimeStamp.cxx:226
 TTimeStamp.cxx:227
 TTimeStamp.cxx:228
 TTimeStamp.cxx:229
 TTimeStamp.cxx:230
 TTimeStamp.cxx:231
 TTimeStamp.cxx:232
 TTimeStamp.cxx:233
 TTimeStamp.cxx:234
 TTimeStamp.cxx:235
 TTimeStamp.cxx:236
 TTimeStamp.cxx:237
 TTimeStamp.cxx:238
 TTimeStamp.cxx:239
 TTimeStamp.cxx:240
 TTimeStamp.cxx:241
 TTimeStamp.cxx:242
 TTimeStamp.cxx:243
 TTimeStamp.cxx:244
 TTimeStamp.cxx:245
 TTimeStamp.cxx:246
 TTimeStamp.cxx:247
 TTimeStamp.cxx:248
 TTimeStamp.cxx:249
 TTimeStamp.cxx:250
 TTimeStamp.cxx:251
 TTimeStamp.cxx:252
 TTimeStamp.cxx:253
 TTimeStamp.cxx:254
 TTimeStamp.cxx:255
 TTimeStamp.cxx:256
 TTimeStamp.cxx:257
 TTimeStamp.cxx:258
 TTimeStamp.cxx:259
 TTimeStamp.cxx:260
 TTimeStamp.cxx:261
 TTimeStamp.cxx:262
 TTimeStamp.cxx:263
 TTimeStamp.cxx:264
 TTimeStamp.cxx:265
 TTimeStamp.cxx:266
 TTimeStamp.cxx:267
 TTimeStamp.cxx:268
 TTimeStamp.cxx:269
 TTimeStamp.cxx:270
 TTimeStamp.cxx:271
 TTimeStamp.cxx:272
 TTimeStamp.cxx:273
 TTimeStamp.cxx:274
 TTimeStamp.cxx:275
 TTimeStamp.cxx:276
 TTimeStamp.cxx:277
 TTimeStamp.cxx:278
 TTimeStamp.cxx:279
 TTimeStamp.cxx:280
 TTimeStamp.cxx:281
 TTimeStamp.cxx:282
 TTimeStamp.cxx:283
 TTimeStamp.cxx:284
 TTimeStamp.cxx:285
 TTimeStamp.cxx:286
 TTimeStamp.cxx:287
 TTimeStamp.cxx:288
 TTimeStamp.cxx:289
 TTimeStamp.cxx:290
 TTimeStamp.cxx:291
 TTimeStamp.cxx:292
 TTimeStamp.cxx:293
 TTimeStamp.cxx:294
 TTimeStamp.cxx:295
 TTimeStamp.cxx:296
 TTimeStamp.cxx:297
 TTimeStamp.cxx:298
 TTimeStamp.cxx:299
 TTimeStamp.cxx:300
 TTimeStamp.cxx:301
 TTimeStamp.cxx:302
 TTimeStamp.cxx:303
 TTimeStamp.cxx:304
 TTimeStamp.cxx:305
 TTimeStamp.cxx:306
 TTimeStamp.cxx:307
 TTimeStamp.cxx:308
 TTimeStamp.cxx:309
 TTimeStamp.cxx:310
 TTimeStamp.cxx:311
 TTimeStamp.cxx:312
 TTimeStamp.cxx:313
 TTimeStamp.cxx:314
 TTimeStamp.cxx:315
 TTimeStamp.cxx:316
 TTimeStamp.cxx:317
 TTimeStamp.cxx:318
 TTimeStamp.cxx:319
 TTimeStamp.cxx:320
 TTimeStamp.cxx:321
 TTimeStamp.cxx:322
 TTimeStamp.cxx:323
 TTimeStamp.cxx:324
 TTimeStamp.cxx:325
 TTimeStamp.cxx:326
 TTimeStamp.cxx:327
 TTimeStamp.cxx:328
 TTimeStamp.cxx:329
 TTimeStamp.cxx:330
 TTimeStamp.cxx:331
 TTimeStamp.cxx:332
 TTimeStamp.cxx:333
 TTimeStamp.cxx:334
 TTimeStamp.cxx:335
 TTimeStamp.cxx:336
 TTimeStamp.cxx:337
 TTimeStamp.cxx:338
 TTimeStamp.cxx:339
 TTimeStamp.cxx:340
 TTimeStamp.cxx:341
 TTimeStamp.cxx:342
 TTimeStamp.cxx:343
 TTimeStamp.cxx:344
 TTimeStamp.cxx:345
 TTimeStamp.cxx:346
 TTimeStamp.cxx:347
 TTimeStamp.cxx:348
 TTimeStamp.cxx:349
 TTimeStamp.cxx:350
 TTimeStamp.cxx:351
 TTimeStamp.cxx:352
 TTimeStamp.cxx:353
 TTimeStamp.cxx:354
 TTimeStamp.cxx:355
 TTimeStamp.cxx:356
 TTimeStamp.cxx:357
 TTimeStamp.cxx:358
 TTimeStamp.cxx:359
 TTimeStamp.cxx:360
 TTimeStamp.cxx:361
 TTimeStamp.cxx:362
 TTimeStamp.cxx:363
 TTimeStamp.cxx:364
 TTimeStamp.cxx:365
 TTimeStamp.cxx:366
 TTimeStamp.cxx:367
 TTimeStamp.cxx:368
 TTimeStamp.cxx:369
 TTimeStamp.cxx:370
 TTimeStamp.cxx:371
 TTimeStamp.cxx:372
 TTimeStamp.cxx:373
 TTimeStamp.cxx:374
 TTimeStamp.cxx:375
 TTimeStamp.cxx:376
 TTimeStamp.cxx:377
 TTimeStamp.cxx:378
 TTimeStamp.cxx:379
 TTimeStamp.cxx:380
 TTimeStamp.cxx:381
 TTimeStamp.cxx:382
 TTimeStamp.cxx:383
 TTimeStamp.cxx:384
 TTimeStamp.cxx:385
 TTimeStamp.cxx:386
 TTimeStamp.cxx:387
 TTimeStamp.cxx:388
 TTimeStamp.cxx:389
 TTimeStamp.cxx:390
 TTimeStamp.cxx:391
 TTimeStamp.cxx:392
 TTimeStamp.cxx:393
 TTimeStamp.cxx:394
 TTimeStamp.cxx:395
 TTimeStamp.cxx:396
 TTimeStamp.cxx:397
 TTimeStamp.cxx:398
 TTimeStamp.cxx:399
 TTimeStamp.cxx:400
 TTimeStamp.cxx:401
 TTimeStamp.cxx:402
 TTimeStamp.cxx:403
 TTimeStamp.cxx:404
 TTimeStamp.cxx:405
 TTimeStamp.cxx:406
 TTimeStamp.cxx:407
 TTimeStamp.cxx:408
 TTimeStamp.cxx:409
 TTimeStamp.cxx:410
 TTimeStamp.cxx:411
 TTimeStamp.cxx:412
 TTimeStamp.cxx:413
 TTimeStamp.cxx:414
 TTimeStamp.cxx:415
 TTimeStamp.cxx:416
 TTimeStamp.cxx:417
 TTimeStamp.cxx:418
 TTimeStamp.cxx:419
 TTimeStamp.cxx:420
 TTimeStamp.cxx:421
 TTimeStamp.cxx:422
 TTimeStamp.cxx:423
 TTimeStamp.cxx:424
 TTimeStamp.cxx:425
 TTimeStamp.cxx:426
 TTimeStamp.cxx:427
 TTimeStamp.cxx:428
 TTimeStamp.cxx:429
 TTimeStamp.cxx:430
 TTimeStamp.cxx:431
 TTimeStamp.cxx:432
 TTimeStamp.cxx:433
 TTimeStamp.cxx:434
 TTimeStamp.cxx:435
 TTimeStamp.cxx:436
 TTimeStamp.cxx:437
 TTimeStamp.cxx:438
 TTimeStamp.cxx:439
 TTimeStamp.cxx:440
 TTimeStamp.cxx:441
 TTimeStamp.cxx:442
 TTimeStamp.cxx:443
 TTimeStamp.cxx:444
 TTimeStamp.cxx:445
 TTimeStamp.cxx:446
 TTimeStamp.cxx:447
 TTimeStamp.cxx:448
 TTimeStamp.cxx:449
 TTimeStamp.cxx:450
 TTimeStamp.cxx:451
 TTimeStamp.cxx:452
 TTimeStamp.cxx:453
 TTimeStamp.cxx:454
 TTimeStamp.cxx:455
 TTimeStamp.cxx:456
 TTimeStamp.cxx:457
 TTimeStamp.cxx:458
 TTimeStamp.cxx:459
 TTimeStamp.cxx:460
 TTimeStamp.cxx:461
 TTimeStamp.cxx:462
 TTimeStamp.cxx:463
 TTimeStamp.cxx:464
 TTimeStamp.cxx:465
 TTimeStamp.cxx:466
 TTimeStamp.cxx:467
 TTimeStamp.cxx:468
 TTimeStamp.cxx:469
 TTimeStamp.cxx:470
 TTimeStamp.cxx:471
 TTimeStamp.cxx:472
 TTimeStamp.cxx:473
 TTimeStamp.cxx:474
 TTimeStamp.cxx:475
 TTimeStamp.cxx:476
 TTimeStamp.cxx:477
 TTimeStamp.cxx:478
 TTimeStamp.cxx:479
 TTimeStamp.cxx:480
 TTimeStamp.cxx:481
 TTimeStamp.cxx:482
 TTimeStamp.cxx:483
 TTimeStamp.cxx:484
 TTimeStamp.cxx:485
 TTimeStamp.cxx:486
 TTimeStamp.cxx:487
 TTimeStamp.cxx:488
 TTimeStamp.cxx:489
 TTimeStamp.cxx:490
 TTimeStamp.cxx:491
 TTimeStamp.cxx:492
 TTimeStamp.cxx:493
 TTimeStamp.cxx:494
 TTimeStamp.cxx:495
 TTimeStamp.cxx:496
 TTimeStamp.cxx:497
 TTimeStamp.cxx:498
 TTimeStamp.cxx:499
 TTimeStamp.cxx:500
 TTimeStamp.cxx:501
 TTimeStamp.cxx:502
 TTimeStamp.cxx:503
 TTimeStamp.cxx:504
 TTimeStamp.cxx:505
 TTimeStamp.cxx:506
 TTimeStamp.cxx:507
 TTimeStamp.cxx:508
 TTimeStamp.cxx:509
 TTimeStamp.cxx:510
 TTimeStamp.cxx:511
 TTimeStamp.cxx:512
 TTimeStamp.cxx:513
 TTimeStamp.cxx:514
 TTimeStamp.cxx:515
 TTimeStamp.cxx:516
 TTimeStamp.cxx:517
 TTimeStamp.cxx:518
 TTimeStamp.cxx:519
 TTimeStamp.cxx:520
 TTimeStamp.cxx:521
 TTimeStamp.cxx:522
 TTimeStamp.cxx:523
 TTimeStamp.cxx:524
 TTimeStamp.cxx:525
 TTimeStamp.cxx:526
 TTimeStamp.cxx:527
 TTimeStamp.cxx:528
 TTimeStamp.cxx:529
 TTimeStamp.cxx:530
 TTimeStamp.cxx:531
 TTimeStamp.cxx:532
 TTimeStamp.cxx:533
 TTimeStamp.cxx:534
 TTimeStamp.cxx:535
 TTimeStamp.cxx:536
 TTimeStamp.cxx:537
 TTimeStamp.cxx:538
 TTimeStamp.cxx:539
 TTimeStamp.cxx:540
 TTimeStamp.cxx:541
 TTimeStamp.cxx:542
 TTimeStamp.cxx:543
 TTimeStamp.cxx:544
 TTimeStamp.cxx:545
 TTimeStamp.cxx:546
 TTimeStamp.cxx:547
 TTimeStamp.cxx:548
 TTimeStamp.cxx:549
 TTimeStamp.cxx:550
 TTimeStamp.cxx:551
 TTimeStamp.cxx:552
 TTimeStamp.cxx:553
 TTimeStamp.cxx:554
 TTimeStamp.cxx:555
 TTimeStamp.cxx:556
 TTimeStamp.cxx:557
 TTimeStamp.cxx:558
 TTimeStamp.cxx:559
 TTimeStamp.cxx:560
 TTimeStamp.cxx:561
 TTimeStamp.cxx:562
 TTimeStamp.cxx:563
 TTimeStamp.cxx:564
 TTimeStamp.cxx:565
 TTimeStamp.cxx:566
 TTimeStamp.cxx:567
 TTimeStamp.cxx:568
 TTimeStamp.cxx:569
 TTimeStamp.cxx:570
 TTimeStamp.cxx:571
 TTimeStamp.cxx:572
 TTimeStamp.cxx:573
 TTimeStamp.cxx:574
 TTimeStamp.cxx:575
 TTimeStamp.cxx:576
 TTimeStamp.cxx:577
 TTimeStamp.cxx:578
 TTimeStamp.cxx:579
 TTimeStamp.cxx:580
 TTimeStamp.cxx:581
 TTimeStamp.cxx:582
 TTimeStamp.cxx:583
 TTimeStamp.cxx:584
 TTimeStamp.cxx:585
 TTimeStamp.cxx:586
 TTimeStamp.cxx:587
 TTimeStamp.cxx:588
 TTimeStamp.cxx:589
 TTimeStamp.cxx:590
 TTimeStamp.cxx:591
 TTimeStamp.cxx:592
 TTimeStamp.cxx:593
 TTimeStamp.cxx:594
 TTimeStamp.cxx:595
 TTimeStamp.cxx:596
 TTimeStamp.cxx:597
 TTimeStamp.cxx:598
 TTimeStamp.cxx:599
 TTimeStamp.cxx:600
 TTimeStamp.cxx:601
 TTimeStamp.cxx:602
 TTimeStamp.cxx:603
 TTimeStamp.cxx:604
 TTimeStamp.cxx:605
 TTimeStamp.cxx:606
 TTimeStamp.cxx:607
 TTimeStamp.cxx:608
 TTimeStamp.cxx:609
 TTimeStamp.cxx:610
 TTimeStamp.cxx:611
 TTimeStamp.cxx:612
 TTimeStamp.cxx:613
 TTimeStamp.cxx:614
 TTimeStamp.cxx:615
 TTimeStamp.cxx:616
 TTimeStamp.cxx:617
 TTimeStamp.cxx:618
 TTimeStamp.cxx:619
 TTimeStamp.cxx:620
 TTimeStamp.cxx:621
 TTimeStamp.cxx:622
 TTimeStamp.cxx:623
 TTimeStamp.cxx:624
 TTimeStamp.cxx:625
 TTimeStamp.cxx:626
 TTimeStamp.cxx:627
 TTimeStamp.cxx:628
 TTimeStamp.cxx:629
 TTimeStamp.cxx:630
 TTimeStamp.cxx:631
 TTimeStamp.cxx:632
 TTimeStamp.cxx:633
 TTimeStamp.cxx:634
 TTimeStamp.cxx:635
 TTimeStamp.cxx:636
 TTimeStamp.cxx:637
 TTimeStamp.cxx:638
 TTimeStamp.cxx:639
 TTimeStamp.cxx:640
 TTimeStamp.cxx:641
 TTimeStamp.cxx:642
 TTimeStamp.cxx:643
 TTimeStamp.cxx:644
 TTimeStamp.cxx:645
 TTimeStamp.cxx:646
 TTimeStamp.cxx:647
 TTimeStamp.cxx:648
 TTimeStamp.cxx:649
 TTimeStamp.cxx:650
 TTimeStamp.cxx:651
 TTimeStamp.cxx:652
 TTimeStamp.cxx:653
 TTimeStamp.cxx:654
 TTimeStamp.cxx:655
 TTimeStamp.cxx:656
 TTimeStamp.cxx:657
 TTimeStamp.cxx:658
 TTimeStamp.cxx:659
 TTimeStamp.cxx:660
 TTimeStamp.cxx:661
 TTimeStamp.cxx:662
 TTimeStamp.cxx:663
 TTimeStamp.cxx:664
 TTimeStamp.cxx:665
 TTimeStamp.cxx:666
 TTimeStamp.cxx:667
 TTimeStamp.cxx:668
 TTimeStamp.cxx:669
 TTimeStamp.cxx:670
 TTimeStamp.cxx:671
 TTimeStamp.cxx:672
 TTimeStamp.cxx:673
 TTimeStamp.cxx:674
 TTimeStamp.cxx:675
 TTimeStamp.cxx:676
 TTimeStamp.cxx:677
 TTimeStamp.cxx:678
 TTimeStamp.cxx:679
 TTimeStamp.cxx:680
 TTimeStamp.cxx:681
 TTimeStamp.cxx:682
 TTimeStamp.cxx:683
 TTimeStamp.cxx:684
 TTimeStamp.cxx:685
 TTimeStamp.cxx:686
 TTimeStamp.cxx:687
 TTimeStamp.cxx:688
 TTimeStamp.cxx:689
 TTimeStamp.cxx:690
 TTimeStamp.cxx:691
 TTimeStamp.cxx:692
 TTimeStamp.cxx:693
 TTimeStamp.cxx:694
 TTimeStamp.cxx:695
 TTimeStamp.cxx:696
 TTimeStamp.cxx:697
 TTimeStamp.cxx:698
 TTimeStamp.cxx:699
 TTimeStamp.cxx:700
 TTimeStamp.cxx:701
 TTimeStamp.cxx:702
 TTimeStamp.cxx:703
 TTimeStamp.cxx:704
 TTimeStamp.cxx:705
 TTimeStamp.cxx:706
 TTimeStamp.cxx:707
 TTimeStamp.cxx:708
 TTimeStamp.cxx:709
 TTimeStamp.cxx:710
 TTimeStamp.cxx:711
 TTimeStamp.cxx:712
 TTimeStamp.cxx:713
 TTimeStamp.cxx:714
 TTimeStamp.cxx:715
 TTimeStamp.cxx:716
 TTimeStamp.cxx:717
 TTimeStamp.cxx:718
 TTimeStamp.cxx:719
 TTimeStamp.cxx:720
 TTimeStamp.cxx:721
 TTimeStamp.cxx:722
 TTimeStamp.cxx:723
 TTimeStamp.cxx:724
 TTimeStamp.cxx:725
 TTimeStamp.cxx:726
 TTimeStamp.cxx:727
 TTimeStamp.cxx:728
 TTimeStamp.cxx:729
 TTimeStamp.cxx:730
 TTimeStamp.cxx:731
 TTimeStamp.cxx:732
 TTimeStamp.cxx:733
 TTimeStamp.cxx:734
 TTimeStamp.cxx:735
 TTimeStamp.cxx:736
 TTimeStamp.cxx:737
 TTimeStamp.cxx:738
 TTimeStamp.cxx:739
 TTimeStamp.cxx:740
 TTimeStamp.cxx:741
 TTimeStamp.cxx:742
 TTimeStamp.cxx:743
 TTimeStamp.cxx:744
 TTimeStamp.cxx:745
 TTimeStamp.cxx:746
 TTimeStamp.cxx:747
 TTimeStamp.cxx:748
 TTimeStamp.cxx:749
 TTimeStamp.cxx:750
 TTimeStamp.cxx:751
 TTimeStamp.cxx:752
 TTimeStamp.cxx:753
 TTimeStamp.cxx:754
 TTimeStamp.cxx:755
 TTimeStamp.cxx:756
 TTimeStamp.cxx:757
 TTimeStamp.cxx:758
 TTimeStamp.cxx:759
 TTimeStamp.cxx:760
 TTimeStamp.cxx:761
 TTimeStamp.cxx:762
 TTimeStamp.cxx:763
 TTimeStamp.cxx:764
 TTimeStamp.cxx:765
 TTimeStamp.cxx:766
 TTimeStamp.cxx:767
 TTimeStamp.cxx:768
 TTimeStamp.cxx:769
 TTimeStamp.cxx:770
 TTimeStamp.cxx:771
 TTimeStamp.cxx:772
 TTimeStamp.cxx:773
 TTimeStamp.cxx:774
 TTimeStamp.cxx:775
 TTimeStamp.cxx:776
 TTimeStamp.cxx:777
 TTimeStamp.cxx:778
 TTimeStamp.cxx:779
 TTimeStamp.cxx:780
 TTimeStamp.cxx:781
 TTimeStamp.cxx:782
 TTimeStamp.cxx:783
 TTimeStamp.cxx:784
 TTimeStamp.cxx:785
 TTimeStamp.cxx:786
 TTimeStamp.cxx:787
 TTimeStamp.cxx:788
 TTimeStamp.cxx:789
 TTimeStamp.cxx:790
 TTimeStamp.cxx:791
 TTimeStamp.cxx:792
 TTimeStamp.cxx:793
 TTimeStamp.cxx:794
 TTimeStamp.cxx:795
 TTimeStamp.cxx:796
 TTimeStamp.cxx:797
 TTimeStamp.cxx:798
 TTimeStamp.cxx:799
 TTimeStamp.cxx:800
 TTimeStamp.cxx:801
 TTimeStamp.cxx:802
 TTimeStamp.cxx:803
 TTimeStamp.cxx:804
 TTimeStamp.cxx:805
 TTimeStamp.cxx:806
 TTimeStamp.cxx:807
 TTimeStamp.cxx:808
 TTimeStamp.cxx:809
 TTimeStamp.cxx:810
 TTimeStamp.cxx:811
 TTimeStamp.cxx:812
 TTimeStamp.cxx:813
 TTimeStamp.cxx:814
 TTimeStamp.cxx:815
 TTimeStamp.cxx:816
 TTimeStamp.cxx:817
 TTimeStamp.cxx:818
 TTimeStamp.cxx:819
 TTimeStamp.cxx:820
 TTimeStamp.cxx:821
 TTimeStamp.cxx:822
 TTimeStamp.cxx:823