Project
Loading...
Searching...
No Matches
Clock.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12/*
13 * File: Clock.hpp
14 * Author: John Lång (john.larry.lang@cern.ch)
15 *
16 * Created on 29 August 2016, 9:29
17 */
18#ifndef O2_DCS_CLOCK_H
19#define O2_DCS_CLOCK_H
20
21#include <ctime>
22#include <cstdint>
23#include <chrono>
24#include <memory>
25#include <string>
26
27namespace o2
28{
29namespace dcs
30{
40 const std::chrono::steady_clock::time_point beginning) noexcept
41{
42 return std::chrono::duration_cast<std::chrono::milliseconds>(
43 std::chrono::steady_clock::now() - beginning)
44 .count();
45}
46
54inline uint64_t epoch_time() noexcept
55{
56 return std::chrono::duration_cast<std::chrono::milliseconds>(
57 std::chrono::system_clock::now().time_since_epoch())
58 .count();
59}
60
69inline uint64_t now() noexcept
70{
71 return std::chrono::duration_cast<std::chrono::milliseconds>(
72 std::chrono::steady_clock::now().time_since_epoch())
73 .count();
74}
75
84inline std::string timestamp() noexcept
85{
86 char buffer[20];
87 std::time_t now = std::time(nullptr);
88 std::strftime(buffer, 32, "%F %T", std::localtime(&now));
89 return std::string(buffer);
90}
91
101inline std::string timestamp(const std::string& format) noexcept
102{
103 char buffer[20];
104 std::time_t now = std::time(nullptr);
105 std::strftime(buffer, 32, format.c_str(), std::localtime(&now));
106 return std::string(buffer);
107}
108
120inline std::string fs_timestamp() noexcept
121{
122 char buffer[20];
123 std::time_t now = std::time(nullptr);
124 std::strftime(buffer, 32, "%F_%H.%M.%S", std::localtime(&now));
125 return std::string(buffer);
126}
127} // namespace dcs
128} // namespace o2
129
130#endif /* O2_DCS_CLOCK_H */
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
GLint GLint GLsizei GLint GLenum format
Definition glcorearb.h:275
uint64_t now() noexcept
Definition Clock.h:69
std::string fs_timestamp() noexcept
Definition Clock.h:120
uint64_t epoch_time() noexcept
Definition Clock.h:54
std::string timestamp() noexcept
Definition Clock.h:84
uint64_t time_since(const std::chrono::steady_clock::time_point beginning) noexcept
Definition Clock.h:39
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...