ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
graphics
VP1
VP1UtilsBase
src
VP1TimeUtilities.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// //
7
// Implementation of class VP1TimeUtilities //
8
// //
9
// Author: Riccardo Maria Bianchi <rbianchi@cern.ch> //
10
// //
11
// Initial version: Jan 2019 //
12
// //
14
15
16
#include "
VP1UtilsBase/VP1TimeUtilities.h
"
17
18
#include <iostream>
19
#include <iomanip>
20
#include <string>
21
#include <sstream>
// for std::ostringstream
22
23
24
std::string
VP1TimeUtilities::getHumanReadableTimestamp
(time_t t_timestamp)
25
{
26
struct
tm ltm;
27
localtime_r(&t_timestamp, <m);
28
29
std::string humanTimestamp;
30
31
std::ostringstream ostri;
32
ostri << 1900 + ltm.tm_year
33
<<
"-"
<< 1 + ltm.tm_mon
// tm_mon is in the range [0, 11], so 1 must be added to get real months
34
<<
"-"
<< ltm.tm_mday
35
<<
"T"
<< ltm.tm_hour <<
"-"
<< ltm.tm_min <<
"-"
<< ltm.tm_sec;
// << "CEST"; FIXME: check if time zone is available on data file
36
37
humanTimestamp = ostri.str();
38
//std::cout << "'human readable' timestamp: " << m_humanTimestamp << std::endl;
39
return
humanTimestamp;
40
}
VP1TimeUtilities.h
VP1TimeUtilities::getHumanReadableTimestamp
static std::string getHumanReadableTimestamp(time_t t_timestamp)
Definition
VP1TimeUtilities.cxx:24
Generated on
for ATLAS Offline Software by
1.17.0