Kea 2.7.0
time_utils.h
Go to the documentation of this file.
1// Copyright (C) 2024 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_UTILS_H
8#define TIME_UTILS_H 1
9
11
12#include <cstdint>
13#include <string>
14#include <sys/types.h>
15
16namespace isc {
17namespace util {
18
21class InvalidTime : public Exception {
22public:
23 InvalidTime(const char* file, size_t line, const char* what)
24 : isc::Exception(file, line, what) {
25 }
26};
27
28namespace detail {
29
54int64_t
56
57} // namespace detail
58
72
105uint64_t
106timeFromText64(const std::string& time_txt);
107
117uint32_t
118timeFromText32(const std::string& time_txt);
119
135std::string
136timeToText64(uint64_t value);
137
161std::string
162timeToText32(uint32_t value);
164
165} // namespace util
166} // namespace isc
167
168#endif // TIME_UTILS_H
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 ...
Definition time_utils.h:21
InvalidTime(const char *file, size_t line, const char *what)
Definition time_utils.h:23
int64_t getTimeWrapper()
Return the current time in seconds.
Definition time_utils.cc:72
uint32_t timeFromText32(const string &time_txt)
Convert textual DNSSEC time to integer, 32-bit version.
string timeToText64(uint64_t value)
Convert integral DNSSEC time to textual form, 64-bit version.
Definition time_utils.cc:85
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.
Defines the logger used by the top-level component of kea-lfc.