/* This file is part of FediBlock-backend. * Copyright © 2020 tastytea * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ #ifndef FEDIBLOCK_BACKEND_TIME_HPP #define FEDIBLOCK_BACKEND_TIME_HPP #include #include #include namespace FediBlock::time { using std::string; using std::string_view; using std::chrono::system_clock; /*! * @brief Return date and time as string. * @param timepoint The point in time to convert. * @param format Format of the string (optional, defaults to %FT%T). * * See strftime(3) for information on how to construct a valid format string. * * @since 0.2.0 */ [[nodiscard]] string to_string(const system_clock::time_point &timepoint, string_view format = "%FT%T"); /*! * @brief Return date and time as string. * @param timestring The time string to convert. Must be %FT%T. * @param format Format of the string (optional, defaults to %FT%T). * * See strftime(3) for information on how to construct a valid format string. * * @since 0.2.0 */ [[nodiscard]] string to_string(string_view timestring, string_view format = "%FT%T"); } // namespace FediBlock::time #endif // FEDIBLOCK_BACKEND_TIME_HPP