Kea 2.5.7
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
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
23namespace isc {
24namespace util {
25
30class InvalidTime : public Exception {
31public:
32 InvalidTime(const char* file, size_t line, const char* what) :
33 isc::Exception(file, line, what) {}
34};
35
36namespace detail {
59int64_t gettimeWrapper();
60}
61
76
77
107uint64_t
108timeFromText64(const std::string& time_txt);
109
115uint32_t
116timeFromText32(const std::string& time_txt);
117
132std::string
133timeToText64(uint64_t value);
134
154std::string
155timeToText32(const uint32_t value);
156
158}
159}
160
161#endif // TIME_UTILITIES_H
162
163// Local Variables:
164// mode: c++
165// End:
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
A standard DNS (or ISC) module exception that is thrown if a time conversion function encounters bad ...
InvalidTime(const char *file, size_t line, const char *what)
int64_t gettimeWrapper()
Return the current time in seconds.
uint32_t timeFromText32(const string &time_txt)
Convert textual DNSSEC time to integer, 32-bit version.
string timeToText32(const uint32_t value)
Convert integral DNSSEC time to textual form, 32-bit version.
string timeToText64(uint64_t value)
Convert integral DNSSEC time to textual form, 64-bit version.
uint64_t timeFromText64(const string &time_txt)
Convert textual DNSSEC time to integer, 64-bit version.
Defines the logger used by the top-level component of kea-lfc.