Belle II Software development
Date.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#ifndef _Belle2_Date_hh
9#define _Belle2_Date_hh
10
11#include <time.h>
12
13namespace Belle2 {
18
19 class Date {
20
21 public:
22 explicit Date(time_t time);
23 Date(const Date& date);
24 Date();
25 ~Date();
26
27 public:
28 void set();
29 void set(time_t time);
30 time_t get() const { return m_time; }
31 int getSecond() const;
32 int getMinitue() const;
33 int getHour() const;
34 int getDay() const;
35 int getMonth() const;
36 int getYear() const;
37 const char* toString(const char* format = NULL) const;
38
39 public:
40 // cppcheck-suppress operatorEqVarError ; m_str is a scratch buffer rebuilt by toString()
41 const Date& operator=(const Date& date)
42 {
43 set(date.m_time);
44 return *this;
45 }
46
47 private:
48 time_t m_time;
49 struct tm* m_tm;
50 mutable char m_str[31] = {};
51
52 };
53
55};
56
57#endif
Abstract base class for different kinds of events.