Kea: time_utils.h Source File

| Kea 3.2.0-git

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
10#include <exceptions/exceptions.h>
11
12#include <cstdint>
13#include <string>
14#include <sys/types.h>
15
16namespace isc {
17namespace util {
18
21 class 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
55 getTimeWrapper();
56
57} // namespace detail
58
72
105uint64_t
106 timeFromText64(const std::string& time_txt);
107
117uint32_t
118 timeFromText32(const std::string& time_txt);
119
135std::string
136 timeToText64(uint64_t value);
137
161std::string
162 timeToText32(uint32_t value);
164
165} // namespace util
166} // namespace isc
167
168#endif // TIME_UTILS_H
isc::Exception::Exception
Exception(const char *file, size_t line, const char *what)
Constructor for a given type for exceptions with file name and file line number.
Definition exceptions/exceptions.cc:17
isc::Exception::what
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Definition exceptions/exceptions.cc:32
isc::util::InvalidTime::InvalidTime
InvalidTime(const char *file, size_t line, const char *what)
Definition time_utils.h:23
exceptions.h
isc::detail
Definition cfgrpt.cc:14
isc::util::detail::getTimeWrapper
int64_t getTimeWrapper()
Return the current time in seconds.
Definition time_utils.cc:72
isc::util::file
Definition filesystem.cc:29
isc::util
Definition time_utils.cc:43
isc::util::timeFromText32
uint32_t timeFromText32(const string &time_txt)
Convert textual DNSSEC time to integer, 32-bit version.
Definition time_utils.cc:188
isc::util::timeToText64
string timeToText64(uint64_t value)
Convert integral DNSSEC time to textual form, 64-bit version.
Definition time_utils.cc:85
isc::util::timeFromText64
uint64_t timeFromText64(const string &time_txt)
Convert textual DNSSEC time to integer, 64-bit version.
Definition time_utils.cc:149
isc::util::timeToText32
string timeToText32(const uint32_t value)
Convert integral DNSSEC time to textual form, 32-bit version.
Definition time_utils.cc:133
isc
Defines the logger used by the top-level component of kea-lfc.
Definition check_exists_add.cc:18