libtime++: Date and time calculation

◆ utc()

TAbsoluteTime libtime::utc ( )

return system time in UTC

Definition at line 58 of file now.cc.

Referenced by main().

59 {
60  std::time_t nowtime=std::time(NULL);
61  std::tm *nowtm=std::gmtime(&nowtime);
62  int year=nowtm->tm_year+1900;
63  int month=nowtm->tm_mon+1;
64  int day=nowtm->tm_mday;
65  int hour=nowtm->tm_hour;
66  int minute=nowtm->tm_min;
67  int second=nowtm->tm_sec;
68  TAbsoluteTime thetime(year, month, day, hour, minute, second);
69  return(thetime);
70 } // utc()
Here is the caller graph for this function: