Kea  1.9.9-git
time_utilities.h
Go to the documentation of this file.
1 // Copyright (C) 2009-2015 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef TIME_UTILITIES_H
8 #define TIME_UTILITIES_H 1
9 
10 #include <string>
11 
12 #include <sys/types.h>
13 #include <stdint.h>
14 
15 #include <exceptions/exceptions.h>
16 
17 //
18 // Note: this helper module isn't specific to the DNS protocol per se.
19 // We should probably move this to somewhere else, possibly in some common
20 // utility area.
21 //
22 
23 namespace isc {
24 namespace util {
25 
30 class InvalidTime : public Exception {
31 public:
32  InvalidTime(const char* file, size_t line, const char* what) :
33  isc::Exception(file, line, what) {}
34 };
35 
36 namespace detail {
59 int64_t gettimeWrapper();
60 }
61 
76 
77 uint64_t
108 timeFromText64(const std::string& time_txt);
109 
115 uint32_t
116 timeFromText32(const std::string& time_txt);
117 
132 std::string
133 timeToText64(uint64_t value);
134 
154 std::string
155 timeToText32(const uint32_t value);
156 
158 }
159 }
160 
161 #endif // TIME_UTILITIES_H
162 
163 // Local Variables:
164 // mode: c++
165 // End:
int64_t gettimeWrapper()
Return the current time in seconds.
A standard DNS (or ISC) module exception that is thrown if a time conversion function encounters bad ...
uint64_t timeFromText64(const string &time_txt)
Convert textual DNSSEC time to integer, 64-bit version.
string timeToText32(const uint32_t value)
Convert integral DNSSEC time to textual form, 32-bit version.
uint32_t timeFromText32(const string &time_txt)
Convert textual DNSSEC time to integer, 32-bit version.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-dhcp-ddns.
InvalidTime(const char *file, size_t line, const char *what)
string timeToText64(uint64_t value)
Convert integral DNSSEC time to textual form, 64-bit version.