Botan: src/utils/time.h Source File

Botan 1.10.17

time.h
Go to the documentation of this file.
1 /*
2 * Time Functions
3 * (C) 1999-2009 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7
8 #ifndef BOTAN_TIME_H__
9 #define BOTAN_TIME_H__
10
11 #include <botan/types.h>
12
13 namespace Botan {
14
15 /**
16 * Struct representing a particular date and time
17 */
18 struct BOTAN_DLL calendar_point
19 {
20 /** The year */
21 u32bit year;
22
23 /** The month, 1 through 12 for Jan to Dec */
24 byte month;
25
26 /** The day of the month, 1 through 31 (or 28 or 30 based on month */
27 byte day;
28
29 /** Hour in 24-hour form, 0 to 23 */
30 byte hour;
31
32 /** Minutes in the hour, 0 to 60 */
33 byte minutes;
34
35 /** Seconds in the minute, 0 to 60, but might be slightly
36 larger to deal with leap seconds on some systems
37 */
38 byte seconds;
39
40 /**
41 * Initialize a calendar_point
42 * @param y the year
43 * @param mon the month
44 * @param d the day
45 * @param h the hour
46 * @param min the minute
47 * @param sec the second
48 */
49 calendar_point(u32bit y, byte mon, byte d, byte h, byte min, byte sec) :
50 year(y), month(mon), day(d), hour(h), minutes(min), seconds(sec) {}
51 };
52
53 /**
54 * @param time_point a time point from the system clock
55 * @return calendar_point object representing this time point
56 */
57 BOTAN_DLL calendar_point calendar_value(u64bit time_point);
58
59 /**
60 * @return seconds resolution timestamp, unknown epoch
61 */
62 BOTAN_DLL u64bit system_time();
63
64 /**
65 * @return nanoseconds resolution timestamp, unknown epoch
66 */
67 BOTAN_DLL u64bit get_nanoseconds_clock();
68
69 }
70
71 #endif
Botan::get_nanoseconds_clock
u64bit get_nanoseconds_clock()
Definition: time.cpp:93
Botan::calendar_value
calendar_point calendar_value(u64bit a_time_t)
Definition: time.cpp:81
Botan::calendar_point::month
byte month
Definition: time.h:24
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::calendar_point::seconds
byte seconds
Definition: time.h:38
Botan::u64bit
unsigned long long u64bit
Definition: types.h:49
Botan::calendar_point::year
u32bit year
Definition: time.h:21
Botan::calendar_point
Definition: time.h:18
Botan
Definition: algo_base.h:14
Botan::calendar_point::hour
byte hour
Definition: time.h:30
Botan::calendar_point::day
byte day
Definition: time.h:27
Botan::CT::min
T min(T a, T b)
Definition: ct_utils.h:127
Botan::calendar_point::minutes
byte minutes
Definition: time.h:33
Botan::system_time
u64bit system_time()
Definition: time.cpp:73
Botan::calendar_point::calendar_point
calendar_point(u32bit y, byte mon, byte d, byte h, byte min, byte sec)
Definition: time.h:49
Botan::u32bit
unsigned int u32bit
Definition: types.h:32