Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JSystem/JTime.hh
Go to the documentation of this file.
1#ifndef __JSYSTEM__JTIME__
2#define __JSYSTEM__JTIME__
3
4#include <time.h>
5#include <sys/time.h>
6
7
8/**
9 * \file
10 * System time information.
11 * \author mdejong
12 */
13namespace JSYSTEM {}
14namespace JPP { using namespace JSYSTEM; }
15
16namespace JSYSTEM {
17
18 /**
19 * Type definition of local time.
20 */
21 typedef long long int localtime_t;
22
23
24 /**
25 * Auxililary class to local get time in micro seconds.
26 */
27 struct JLocalTime {
28 /**
29 * Default constructor.
30 */
32 {}
33
34
35 /**
36 * Get local time in micro seconds.
37 *
38 * \return time [us]
39 */
41 {
42 gettimeofday(&t, &tz);
43
44 usec = t.tv_sec;
45 usec *= 1000000ULL;
46 usec += t.tv_usec;
47
48 return usec;
49 }
50
51 private:
53 mutable struct timeval t;
54 mutable struct timezone tz;
55 };
56
57
58 /**
59 * Function object to get local time in micro seconds.
60 */
62}
63
64#endif
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for operating system calls.
static const JLocalTime getLocalTime
Function object to get local time in micro seconds.
long long int localtime_t
Type definition of local time.
Auxililary class to local get time in micro seconds.
JLocalTime()
Default constructor.
struct timezone tz
localtime_t operator()() const
Get local time in micro seconds.