Tkrzw
Namespaces | Functions
tkrzw_time_util.h File Reference

Time utilities. More...

#include <string>
#include <string_view>
#include <cinttypes>
#include <cmath>
#include <ctime>
#include "tkrzw_lib_common.h"

Namespaces

 tkrzw
 Common namespace of Tkrzw.
 

Functions

double tkrzw::GetWallTime ()
 Gets the number of seconds since the UNIX epoch. More...
 
void tkrzw::GetLocalCalendar (int64_t wtime, struct std::tm *cal)
 Gets the local calendar of a time. More...
 
void tkrzw::GetUniversalCalendar (int64_t wtime, struct std::tm *cal)
 Gets the universal calendar of a time. More...
 
int64_t tkrzw::MakeUniversalTime (struct std::tm &cal)
 Makes the UNIX time from a universal calendar. More...
 
int32_t tkrzw::GetLocalTimeDifference (bool use_cache=false)
 Gets the time difference of the local time zone. More...
 
int32_t tkrzw::GetDayOfWeek (int32_t year, int32_t mon, int32_t day)
 Gets the day of week of a date. More...
 
size_t tkrzw::FormatDateSimple (char *result, int64_t wtime=INT64MIN, int32_t td=INT32MIN)
 Formats a date as a simple string in "YYYY/MM/DD hh:mm:ss" format. More...
 
size_t tkrzw::FormatDateSimpleWithFrac (char *result, double wtime=-1, int32_t td=INT32MIN, int32_t frac_cols=6)
 Formats a date as a simple string in "YYYY/MM/DD hh:mm:ss" format. More...
 
size_t tkrzw::FormatDateW3CDTF (char *result, int64_t wtime=INT64MIN, int32_t td=INT32MIN)
 Formats a date as a string in W3CDTF. More...
 
size_t tkrzw::FormatDateW3CDTFWithFrac (char *result, double wtime=-1, int32_t td=INT32MIN, int32_t frac_cols=6)
 Formats a date as a string in W3CDTF. More...
 
size_t tkrzw::FormatDateRFC1123 (char *result, int64_t wtime=INT64MIN, int32_t td=INT32MIN)
 Formats a date as a string in RFC 1123 format. More...
 
double tkrzw::ParseDateStr (std::string_view str)
 Parses a date string to get the time value since the UNIX epoch. More...
 
double tkrzw::ParseDateStrYYYYMMDD (std::string_view str, int32_t td=INT32MIN)
 Parses a date string in "YYYYMMDD" to get the time value since the UNIX epoch. More...
 
std::string tkrzw::MakeRelativeTimeExpr (double diff)
 Makes a human-readable relative time expression of a time difference. More...
 

Detailed Description

Time utilities.