ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TTime.cxx
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Fons Rademakers 28/11/96
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 /** \class TTime
13 Basic time type with millisecond precision.
14 */
15 
16 #include "TTime.h"
17 #include "TString.h"
18 #include "TError.h"
19 
20 
22 
23 ////////////////////////////////////////////////////////////////////////////////
24 /// Return the time as a string.
25 
26 const char *TTime::AsString() const
27 {
28  return Form("%lld", fMilliSec);
29 }
30 
31 ////////////////////////////////////////////////////////////////////////////////
32 
33 TTime::operator long() const
34 {
35 #ifndef R__B64
36  if (fMilliSec > (Long64_t)kMaxInt)
37  Error("TTime::operator long()", "time truncated, use operator long long");
38 #endif
39  return (Long_t) fMilliSec;
40 }
41 
42 ////////////////////////////////////////////////////////////////////////////////
43 
44 TTime::operator unsigned long() const
45 {
46 #ifndef R__B64
47  if (fMilliSec > (Long64_t)kMaxUInt)
48  Error("TTime::operator unsigned long()", "time truncated, use operator unsigned long long");
49 #endif
50  return (ULong_t) fMilliSec;
51 }
long long Long64_t
Definition: RtypesCore.h:69
Basic time type with millisecond precision.
Definition: TTime.h:29
const UInt_t kMaxUInt
Definition: Rtypes.h:102
void Error(const char *location, const char *msgfmt,...)
char * Form(const char *fmt,...)
long Long_t
Definition: RtypesCore.h:50
#define ClassImp(name)
Definition: Rtypes.h:279
unsigned long ULong_t
Definition: RtypesCore.h:51