libtime++: Date and time calculation

◆ double2time()

TRelativeTime libtime::double2time ( const double &  seconds)

convert seconds to relative time

Definition at line 42 of file convert.cc.

References libtime_assert.

Referenced by init_from_seconds().

43 {
44  libtime_assert(seconds>=0,
45  "ERROR (double2time): only positive values are accepted");
46  time_kernel::time_Ts thetime_Ts(TRelativeTime(0));
47  double remain=seconds;
48  typedef timeint li;
49  thetime_Ts.second=li(seconds);
50  remain-=double(thetime_Ts.second);
51  remain*=1.e3;
52  thetime_Ts.milsec=li(remain);
53  remain-=double(thetime_Ts.milsec);
54  remain*=1.e3;
55  thetime_Ts.micsec=li(remain);
56  return(TRelativeTime(thetime_Ts));
57 } // TRelativeTime double2time(const double& seconds)
#define libtime_assert(C, M)
Check an assertion and report by throwing an exception.
Definition: libtime++.h:714
integer timeint
Definition: libtime.h:77
Here is the caller graph for this function: