File indexing completed on 2025-12-16 10:32:27
0001
0002
0003
0004 #pragma once
0005
0006 #include <ctime> // std::time_t
0007 #include <spdlog/common.h>
0008
0009 namespace spdlog {
0010 namespace details {
0011 namespace os {
0012
0013 SPDLOG_API spdlog::log_clock::time_point now() SPDLOG_NOEXCEPT;
0014
0015 SPDLOG_API std::tm localtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT;
0016
0017 SPDLOG_API std::tm localtime() SPDLOG_NOEXCEPT;
0018
0019 SPDLOG_API std::tm gmtime(const std::time_t &time_tt) SPDLOG_NOEXCEPT;
0020
0021 SPDLOG_API std::tm gmtime() SPDLOG_NOEXCEPT;
0022
0023
0024 #if !defined(SPDLOG_EOL)
0025 #ifdef _WIN32
0026 #define SPDLOG_EOL "\r\n"
0027 #else
0028 #define SPDLOG_EOL "\n"
0029 #endif
0030 #endif
0031
0032 SPDLOG_CONSTEXPR static const char *default_eol = SPDLOG_EOL;
0033
0034
0035 #if !defined(SPDLOG_FOLDER_SEPS)
0036 #ifdef _WIN32
0037 #define SPDLOG_FOLDER_SEPS "\\/"
0038 #else
0039 #define SPDLOG_FOLDER_SEPS "/"
0040 #endif
0041 #endif
0042
0043 SPDLOG_CONSTEXPR static const char folder_seps[] = SPDLOG_FOLDER_SEPS;
0044 SPDLOG_CONSTEXPR static const filename_t::value_type folder_seps_filename[] =
0045 SPDLOG_FILENAME_T(SPDLOG_FOLDER_SEPS);
0046
0047
0048 SPDLOG_API bool fopen_s(FILE **fp, const filename_t &filename, const filename_t &mode);
0049
0050
0051 SPDLOG_API int remove(const filename_t &filename) SPDLOG_NOEXCEPT;
0052
0053
0054
0055 SPDLOG_API int remove_if_exists(const filename_t &filename) SPDLOG_NOEXCEPT;
0056
0057 SPDLOG_API int rename(const filename_t &filename1, const filename_t &filename2) SPDLOG_NOEXCEPT;
0058
0059
0060 SPDLOG_API bool path_exists(const filename_t &filename) SPDLOG_NOEXCEPT;
0061
0062
0063 SPDLOG_API size_t filesize(FILE *f);
0064
0065
0066 SPDLOG_API int utc_minutes_offset(const std::tm &tm = details::os::localtime());
0067
0068
0069
0070
0071 SPDLOG_API size_t _thread_id() SPDLOG_NOEXCEPT;
0072
0073
0074 SPDLOG_API size_t thread_id() SPDLOG_NOEXCEPT;
0075
0076
0077
0078 SPDLOG_API void sleep_for_millis(unsigned int milliseconds) SPDLOG_NOEXCEPT;
0079
0080 SPDLOG_API std::string filename_to_str(const filename_t &filename);
0081
0082 SPDLOG_API int pid() SPDLOG_NOEXCEPT;
0083
0084
0085
0086 SPDLOG_API bool is_color_terminal() SPDLOG_NOEXCEPT;
0087
0088
0089
0090 SPDLOG_API bool in_terminal(FILE *file) SPDLOG_NOEXCEPT;
0091
0092 #if (defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) || defined(SPDLOG_WCHAR_FILENAMES)) && defined(_WIN32)
0093 SPDLOG_API void wstr_to_utf8buf(wstring_view_t wstr, memory_buf_t &target);
0094
0095 SPDLOG_API void utf8_to_wstrbuf(string_view_t str, wmemory_buf_t &target);
0096 #endif
0097
0098
0099
0100
0101
0102
0103 SPDLOG_API filename_t dir_name(const filename_t &path);
0104
0105
0106
0107 SPDLOG_API bool create_dir(const filename_t &path);
0108
0109
0110
0111 SPDLOG_API std::string getenv(const char *field);
0112
0113
0114
0115 SPDLOG_API bool fsync(FILE *fp);
0116
0117 }
0118 }
0119 }
0120
0121 #ifdef SPDLOG_HEADER_ONLY
0122 #include "os-inl.h"
0123 #endif