crawlserv++
[under development]
Application for crawling and analyzing textual content of websites.
|
Namespace for global date/time helper functions. More...
Classes | |
class | Exception |
Class for date/time exceptions. More... | |
class | LocaleException |
Class for date/time locale exception. More... | |
Constants | |
constexpr auto | longDateTime {"%a, %d %b %Y %T %Z"} |
The 'long' format for date/times. More... | |
constexpr auto | unixTimeFormat {"UNIX"sv} |
The keyword to use a UNIX time format. More... | |
constexpr auto | unixTimeFormatPlus {"UNIX+"sv} |
The keyword to use a UNIX time format plus an offset. More... | |
constexpr auto | unixTimeFormatMinus {"UNIX-"sv} |
The keyword to use a UNIX time format minus an offset. More... | |
constexpr auto | unixTimeFormatXLength {5} |
The length of the keyword to use a UNIX time format with offset. More... | |
constexpr auto | unixTimeFormatXOffset {4} |
The position of the beginning of a UNIX time format offset. More... | |
constexpr std::array | englishOrdinalSuffixes |
An array containing English ordinal suffixes to be stripped from numbers. More... | |
constexpr std::array | frenchOrdinalSuffixes |
An array containing French ordinal suffix to be stripped from numbers. More... | |
constexpr std::array | russianOrdinalSuffixes |
An array containing Russian ordinal suffixes to be stripped from numbers. More... | |
constexpr std::array | ukrainianOrdinalSuffixes |
An array containing Ukrainian ordinal suffixes to be stripped from numbers. More... | |
constexpr auto | sqlTimeStamp {"%F %T"} |
The date/time format used by the MySQL database (as C string). More... | |
constexpr auto | sqlTimeStampLength {19} |
The length of a formatted time stamp in the MySQL database. More... | |
constexpr auto | englishLocalePrefix {"en"sv} |
The prefix for English locales. More... | |
constexpr auto | frenchLocalePrefix {"fr"sv} |
The prefix for French locales. More... | |
constexpr auto | russianLocalePrefix {"ru"sv} |
The prefix for Russian locales. More... | |
constexpr auto | ukrainianLocalePrefix {"uk"sv} |
The prefix for Ukrainian locales. More... | |
constexpr auto | finnishLocalePrefix {"fi"sv} |
The prefix for Finnish locales. More... | |
constexpr auto | amPmLength {2} |
The length of the 12-h suffix (AM / PM ). More... | |
constexpr auto | hourChange {12} |
The number of hours to be added to a PM time, or to be subtracted from a 12th hour AM time. More... | |
constexpr auto | hourNoonMidnight {12} |
The hour of noon and midnight. More... | |
constexpr auto | centuryFrom {69} |
The two digits from which two-digit years will be interpreted as years after 2000. More... | |
constexpr auto | yearsPerCentury {100} |
The number of years in a century. More... | |
constexpr auto | microsecondsPerDay {86400000000} |
The number of microseconds per day used for date/time formatting. More... | |
constexpr auto | millisecondsPerDay {86400000} |
The number of milliseconds per day used for date/time formatting. More... | |
constexpr auto | secondsPerDay {86400} |
The number of seconds per day used for date/time formatting. More... | |
constexpr auto | microsecondsPerHour {3600000000} |
The number of microseconds per hour used for date/time formatting. More... | |
constexpr auto | millisecondsPerHour {3600000} |
The number of milliseconds per hour used for date/time formatting. More... | |
constexpr auto | secondsPerHour {3600} |
The number of seconds per hour used for date/time formatting. More... | |
constexpr auto | microsecondsPerMinute {60000000} |
The number of microseconds per minute used for date/time formatting. More... | |
constexpr auto | millisecondsPerMinute {60000} |
The number of milliseconds per minute used for date/time formatting. More... | |
constexpr auto | secondsPerMinute {60} |
The number of seconds per minute used for date/time formatting. More... | |
constexpr auto | microsecondsPerSecond {1000000} |
The number of microseconds per second used for date/time formatting. More... | |
constexpr auto | millisecondsPerSecond {1000} |
The number of milliseconds per second used for date/time formatting. More... | |
constexpr auto | microsecondsPerMillisecond {1000} |
The number of microseconds per millisecond used for date/time formatting. More... | |
constexpr auto | isoDateLength {10} |
The length of a date in valid ISO format (YYYY-MM-DD ). More... | |
constexpr auto | yearLength {4} |
The length of a year. More... | |
constexpr auto | isoMonthPos {5} |
The position of the month in an ISO date (YYYY-MM-DD ). More... | |
constexpr auto | isoMonthLength {2} |
The length of the month in an ISO date (YYYY-MM-DD ). More... | |
constexpr auto | minTwoDigitYear {1969} |
Consider two-digit years before this year as being in the 2000s. More... | |
constexpr auto | base10 {10} |
Base of decimal numbers. More... | |
constexpr auto | reducedToMonthLength {7} |
Length of date, reduced to month (YYYY-MM ) More... | |
constexpr auto | daysPerWeek {7} |
Number of days in a week. More... | |
constexpr std::uint8_t | dateWeeks {0} |
Group dates by weeks. More... | |
constexpr std::uint8_t | dateDays {1} |
Group dates by days. More... | |
constexpr std::uint8_t | dateMonths {2} |
Group dates by months. More... | |
constexpr std::uint8_t | dateYears {3} |
Group dates by years. More... | |
Conversion | |
void | convertLongDateTimeToSQLTimeStamp (std::string &dateTime) |
Converts a date/time formatted in a “long” format into the format YYYY-MM-DD HH:MM:SS. More... | |
void | convertCustomDateTimeToSQLTimeStamp (std::string &dateTime, const std::string &customFormat) |
Converts date/time with a custom format into the format YYYY-MM-DD HH:MM:SS. More... | |
void | convertCustomDateTimeToSQLTimeStamp (std::string &dateTime, const std::string &customFormat, const std::string &locale) |
Converts date/time with a custom format into the format YYYY-MM-DD HH:MM:SS. More... | |
void | convertTimeStampToSQLTimeStamp (std::string &timeStamp) |
Converts a timestamp in the YYYYMMDDHHMMSS format to a MySQL timestamp in the YYYY-MM-DD HH:MM:SS format. More... | |
void | convertSQLTimeStampToTimeStamp (std::string &timeStamp) |
Converts a MySQL timestamp in the YYYY-MM-DD HH:MM:SS format to a timestamp in the YYYYMMDDHHMMSS format. More... | |
void | convert12hTo24h (int &hour, bool isPm) |
Converts an hour from the 12h to the 24h system. More... | |
std::string | getYearAndWeek (const std::string &date) |
Get the year and the ISO week number for a specific date. More... | |
void | reduceDate (std::string &date, std::uint8_t resolution) |
Reduce a date to the specified resolution. More... | |
Formatting | |
std::string | microsecondsToString (std::uint64_t microseconds) |
Converts microseconds into a well-formatted string. More... | |
std::string | millisecondsToString (std::uint64_t milliseconds) |
Converts milliseconds into a well-formatted string. More... | |
std::string | secondsToString (std::uint64_t seconds) |
Converts seconds into a well-formatted string. More... | |
std::string | now () |
Formats the current date/time as string in the format YYYY-MM-DD HH:MM:SS. More... | |
Verification | |
bool | isValidISODate (const std::string &isoDate) |
Checks whether a string contains a valid date in the ISO format. More... | |
Comparison | |
bool | isISODateInRange (std::string_view isoDate, std::string_view rangeFrom, std::string_view rangeTo) |
Checks whether the given ISO date is in the given range of dates. More... | |
Gaps inbetween Dates | |
std::vector< std::string > | getDateGap (const std::string &first, const std::string &second, std::uint8_t resolution) |
Gets all dates that lies between two dates. More... | |
std::vector< std::string > | getWeekGap (const std::string &first, const std::string &second) |
Gets all ISO week numbers that lie inbetween two week numbers. More... | |
std::vector< std::string > | getDayGap (const std::string &first, const std::string &second) |
Gets all days that lie inbetween two dates. More... | |
std::vector< std::string > | getMonthGap (const std::string &first, const std::string &second) |
Gets all months that lie inbetween two months. More... | |
std::vector< std::string > | getYearGap (const std::string &first, const std::string &second) |
Gets all years that lies inbetween two years. More... | |
Helpers | |
template<std::size_t N> | |
void | removeOrdinals (const std::array< std::string_view, N > &suffixes, std::string &strInOut) |
Removes all ordinal suffixes after numbers in the given string. More... | |
template<std::size_t N> | |
void | removeOrdinals (std::string_view currentLocale, std::string_view localePrefix, const std::array< std::string_view, N > &suffixes, std::string &strInOut) |
Removes all ordinal suffixes after numbers in the given string, if the current locale matches the given locale. More... | |
void | fixFrenchMonths (std::string_view locale, std::string &strInOut) |
Replaces the abbreviation avr . for the month of april (avril) in the given string, if the locale is French. More... | |
void | fixRussianMonths (std::string_view locale, std::string &strInOut, std::string &formatInOut) |
Shortens Russian month names and replaces the abbreviations май and сент , if the locale is Russian. More... | |
void | fixUkrainianMonths (std::string_view locale, std::string &strInOut, std::string &formatInOut) |
Shortens Ukrainian month names, if the locale is Ukrainian. More... | |
void | fixFinnishMonths (std::string_view locale, std::string_view format, std::string &strInOut) |
Fixes semi-abbreviated Finnish month names (huhtik , touko , etc.), if the locale is Finnish. More... | |
void | extendSingleDigits (std::string &dateTimeString) |
Extends single digits (1-9 ) by adding a leading zero to each of them. More... | |
void | fixYear (std::string &sqlTimeStamp, std::string_view format) |
Changes a year before 1969 into a year after 2000, if it has been parsed from two digits. More... | |
void | handle12hTime (std::string &formatString, const std::string &dateTimeString, bool &outIsAm, bool &outIsPm) |
Handles 12h-time manually to avoid buggy standard library implementations. More... | |
Namespace for global date/time helper functions.
|
inline |
Converts an hour from the 12h to the 24h system.
hour | Reference to the hour which will be changed accordingly, if necessary. |
isPm | Indicates whether the given hour is PM . If false, it will be interpreted as AM . |
References hourChange, and hourNoonMidnight.
Referenced by convertCustomDateTimeToSQLTimeStamp().
|
inline |
Converts date/time with a custom format into the format YYYY-MM-DD
HH:MM:SS.
Calling this function with an empty input string will have no consequences.
For more information on format strings, see Howard Hinnant's paper about his date.h library.
Alternatively, UNIX
, UNIX+<offset>
, or UNIX<-offset>
can be used to convert from a UNIX time plus/minus the given offset.
C
function requires a null-terminated string.dateTime | Reference to a string containing the date/time formatted in the custom format and to be converted in situ. |
customFormat | A const reference to the string containing the date/time format to be converted from. |
DateTime::Exception | of the custom format is invalid or empty, or if the date/time conversion fails. |
References convert12hTo24h(), englishOrdinalSuffixes, extendSingleDigits(), fixYear(), handle12hTime(), removeOrdinals(), sqlTimeStamp, sqlTimeStampLength, unixTimeFormat, unixTimeFormatMinus, unixTimeFormatPlus, unixTimeFormatXLength, and unixTimeFormatXOffset.
Referenced by convertCustomDateTimeToSQLTimeStamp(), convertLongDateTimeToSQLTimeStamp(), convertTimeStampToSQLTimeStamp(), crawlservpp::Module::Parser::Thread::onReset(), crawlservpp::Module::Extractor::Thread::onReset(), and crawlservpp::Main::Server::tick().
|
inline |
Converts date/time with a custom format into the format YYYY-MM-DD
HH:MM:SS.
Calling this function with an empty input string will have no consequences.
For more information on format strings, see Howard Hinnant's paper about his date.h library.
dateTime | A reference to the string containing the date/time formatted in the custom format and to be converted in situ. |
customFormat | A const reference to the string containing the date/time format to be converted from. |
locale | A const reference to the string containing the locale to be used during the conversion. |
DateTime::Exception | of the custom format is invalid or empty, or if the date/time conversion fails. |
References convert12hTo24h(), convertCustomDateTimeToSQLTimeStamp(), englishOrdinalSuffixes, extendSingleDigits(), fixFinnishMonths(), fixFrenchMonths(), fixRussianMonths(), fixUkrainianMonths(), fixYear(), frenchLocalePrefix, frenchOrdinalSuffixes, handle12hTime(), removeOrdinals(), russianLocalePrefix, russianOrdinalSuffixes, sqlTimeStamp, sqlTimeStampLength, ukrainianLocalePrefix, and ukrainianOrdinalSuffixes.
|
inline |
Converts a date/time formatted in a “long” format into the format YYYY-MM-DD
HH:MM:SS.
Calling this function with an empty input string will have no consequences.
dateTime | String containing the date/time formatted in a “long” format and to be converted in situ. |
DateTime::Exception | if the conversion fails. |
References convertCustomDateTimeToSQLTimeStamp(), and longDateTime.
Referenced by crawlservpp::Module::Crawler::Thread::onReset().
|
inline |
Converts a MySQL timestamp in the YYYY-MM-DD
HH:MM:SS format to a timestamp in the YYYYMMDDHHMMSS
format.
Calling this function with an empty input string will have no consequences.
timeStamp | A reference to the string containing a MySQL timestamp in the YYYY-MM-DD HH:MM:SS format to be converted in situ. |
DateTime::Exception | if the conversion fails. |
Referenced by crawlservpp::Module::Crawler::Thread::onReset().
|
inline |
Converts a timestamp in the YYYYMMDDHHMMSS
format to a MySQL timestamp in the YYYY-MM-DD
HH:MM:SS format.
Calling this function with an empty input string will have no consequences.
timeStamp | A reference to the string containing a timestamp in the YYYYMMDDHHMMSS format to be converted in situ. |
DateTime::Exception | if the conversion fails. |
References convertCustomDateTimeToSQLTimeStamp().
Referenced by crawlservpp::Module::Crawler::Thread::onReset().
|
inline |
Extends single digits (1-9
) by adding a leading zero to each of them.
dateTimeString | Reference to the string in which all single digits will be extended. |
Referenced by convertCustomDateTimeToSQLTimeStamp().
|
inline |
Fixes semi-abbreviated Finnish month names (huhtik
, touko
, etc.), if the locale is Finnish.
If the given locale is not Finnish, the function call will be without consequences.
If abbreviated month names (b
) are not considered in the given format string, the function call will be without consequences.
locale | A string view containing the locale to be checked for Finnish. |
format | A reference to the string containing the formatting string that will be checked for abbreviated month names (b ). |
strInOut | A reference to the string containing the date/time, in which the semi-abbreviated months will be replaced, if the given locale is Finnish. |
References finnishLocalePrefix, and crawlservpp::Helper::Strings::replaceAll().
Referenced by convertCustomDateTimeToSQLTimeStamp().
|
inline |
Replaces the abbreviation avr
. for the month of april (avril) in the given string, if the locale is French.
If the given locale is not French, the function call will be without consequences.
locale | A string view containing the locale to be checked for French. |
strInOut | A reference to the string containing the date/time, in which the abbreviation will be replaced if the given locale is French. |
References frenchLocalePrefix, and crawlservpp::Helper::Strings::replaceAll().
Referenced by convertCustomDateTimeToSQLTimeStamp().
|
inline |
Shortens Russian month names and replaces the abbreviations май
and сент
, if the locale is Russian.
If the given locale is English, and the format contains b
or B
, the function will replace the Russified month names maj
, Maj
and MAJ
with the English May
.
Otherwise, the function call will be without consequences.
locale | A string view containing the locale to be checked for Russian or English. |
strInOut | A reference to the string containing the date/time, in which the months will be replaced, if the given locale is Russian or English. |
formatInOut | A reference to the string containing the formatting string that will be changed accordingly, if necessary. |
References englishLocalePrefix, crawlservpp::Helper::Strings::replaceAll(), and russianLocalePrefix.
Referenced by convertCustomDateTimeToSQLTimeStamp().
|
inline |
Shortens Ukrainian month names, if the locale is Ukrainian.
If the given locale is not Ukrainian, the function call will be without consequences.
locale | A string view containing the locale to be checked for Ukrainian. |
strInOut | A reference to the string containing the date/time, in which the months will be replaced, if the given locale is Ukrainian. |
formatInOut | A reference to the string containing the formatting string that will be changed accordingly, if necessary. |
References crawlservpp::Helper::Strings::replaceAll(), and ukrainianLocalePrefix.
Referenced by convertCustomDateTimeToSQLTimeStamp().
|
inline |
Changes a year before 1969 into a year after 2000, if it has been parsed from two digits.
sqlTimeStamp | Reference to the string containing the timestamp that will be changed, if necessary. |
format | View to the string containing the format. If it does not contain y , the call to the function will have no effect. |
References base10, minTwoDigitYear, and yearLength.
Referenced by convertCustomDateTimeToSQLTimeStamp().
|
inline |
Gets all dates that lies between two dates.
first | Constant reference to a string containing the first date. |
second | Constant reference to a string containing the second date. |
resolution | Resolution of the dates. |
DateTime::Exception | if the given dates cannot be converted according to the specified resolution, or the specified resolution is invalid. |
References dateDays, dateMonths, dateWeeks, dateYears, getDayGap(), getMonthGap(), getWeekGap(), and getYearGap().
Referenced by crawlservpp::Module::Analyzer::Algo::WordsOverTime::resetAlgo(), crawlservpp::Module::Analyzer::Algo::AssocOverTime::resetAlgo(), and crawlservpp::Module::Analyzer::Algo::SentimentOverTime::resetAlgo().
|
inline |
Gets all days that lie inbetween two dates.
first | Constant reference to a string containing the first date in the ISO format, i.e. YYYY-MM-DD . |
second | Constant reference to a string containing the second date in the ISO format, i.e. YYYY-MM-DD . |
YYYY-MM-DD
. An empty vector if the given dates are equal or follow each other.DateTime::Exception | if the given dates cannot be converted, i.e. their format is invalid. |
Referenced by getDateGap().
|
inline |
Gets all months that lie inbetween two months.
first | Constant reference to a string containing the first month in the format YYYY-MM . |
second | Constant reference to a string containing the second month in the format YYYY-MM . |
YYYY-MM
. An empty vector if the given months are equal or follow each other.DateTime::Exception | if the given months cannot be converted, i.e. their format is invalid. |
Referenced by getDateGap().
|
inline |
Gets all ISO week numbers that lie inbetween two week numbers.
For more information on ISO week numbers, see https://www.epochconverter.com/weeknumbers.
first | Constant reference to a string containing the first week in the format YYYY-#WW . |
second | Constant reference to a string containing the second week in the format YYYY-#WW . |
YYYY-#WW
. An empty vector if the given weeks are equal or follow each other.DateTime::Exception | if the given weeks cannot be converted, i.e. their format is invalid. |
References daysPerWeek, and getYearAndWeek().
Referenced by getDateGap().
|
inline |
Get the year and the ISO week number for a specific date.
The year of the ISO week might differ from the week of the specified date.
For more information on ISO week numbers, see https://www.epochconverter.com/weeknumbers.
date | Constant reference to a string containing the date in the format YYYY-MM-DD . |
YYYY-#WW
.DateTime::Exception | if the conversion fails. |
Referenced by getWeekGap(), and reduceDate().
|
inline |
Gets all years that lies inbetween two years.
first | Constant reference to a string containing the first year in the format YYYY . |
second | Constant reference to a string containing the second year in the format YYYY . |
YYYY
. An empty vector if the given years are equal or follow each other.DateTime::Exception | if the given years cannot be converted, i.e. their format is invalid. |
References crawlservpp::Main::year.
Referenced by getDateGap().
|
inline |
Handles 12h-time manually to avoid buggy standard library implementations.
If the format contains a 12h suffix (p
), it will be replaced by the actual content of the suffix. For times after noon (pm
), the 12 hours before noon need to be manually added during conversion. For times in the 12th hour, 12 hours need to be subtracted manually from the AM time.
formatString | Reference to a string containing the format of the date/time. |
dateTimeString | Constant reference to a string containing the date/time. |
outIsAm | Reference to a boolean value that will be set to true , if an AM time has been encountered, i.e. during conversion, twelve hours need to be manually subtracted if the given time is in the 12th hour. Otherwise its value will not be changed. |
outIsPm | Reference to a boolean value that will be set to true , if an PM time has been encountered, i.e. during conversion, twelve hours need to be manually added. Otherwise its value will not be changed. |
am
, AM
, pm
, or PM
that is surrounded by white spaces, punctuation, digits and/or the beginning/end of the string, regardless of its actual position. References amPmLength, and crawlservpp::Helper::Strings::replaceAll().
Referenced by convertCustomDateTimeToSQLTimeStamp().
|
inline |
Checks whether the given ISO date is in the given range of dates.
isoDate | A string view containing the date in valid ISO format, i.e. a date in the format YYY-MM-DD . |
rangeFrom | A string view containing the start date of the range in valid ISO format, i.e. a date in the format YYY-MM-DD . |
rangeTo | A string view containing the end date of the range in valid ISO format, i.e. a date in the format YYY-MM-DD . |
References isoDateLength.
Referenced by crawlservpp::Data::Corpus::filterByDate().
|
inline |
Checks whether a string contains a valid date in the ISO format.
isoDate | Constant reference to a string containing the date to check. |
YYY-MM-DD
. False otherwise.
|
inline |
Converts microseconds into a well-formatted string.
microseconds | The number of microseconds to convert. |
References microsecondsPerDay, microsecondsPerHour, microsecondsPerMillisecond, microsecondsPerMinute, and microsecondsPerSecond.
Referenced by crawlservpp::Timer::SimpleHR::tickStr(), and crawlservpp::Timer::StartStopHR::totalStr().
|
inline |
Converts milliseconds into a well-formatted string.
milliseconds | The number of milliseconds to convert. |
References millisecondsPerDay, millisecondsPerHour, millisecondsPerMinute, and millisecondsPerSecond.
Referenced by crawlservpp::Timer::Simple::tickStr(), and crawlservpp::Timer::StartStop::totalStr().
|
inline |
Formats the current date/time as string in the format YYYY-MM-DD
HH:MM:SS.
YYYY-MM-DD
HH:MM:SS. Referenced by crawlservpp::Module::Analyzer::Thread::finished(), crawlservpp::Main::Server::getUpTime(), crawlservpp::Module::Database::log(), crawlservpp::Module::Thread::log(), crawlservpp::Module::Parser::Thread::onClear(), crawlservpp::Module::Extractor::Thread::onClear(), crawlservpp::Module::Crawler::Thread::onClear(), crawlservpp::Module::Parser::Thread::onPause(), crawlservpp::Module::Extractor::Thread::onPause(), crawlservpp::Module::Crawler::Thread::onPause(), crawlservpp::Module::Parser::Thread::onReset(), crawlservpp::Module::Extractor::Thread::onReset(), crawlservpp::Module::Crawler::Thread::onReset(), crawlservpp::Module::Analyzer::Thread::onTick(), crawlservpp::Module::Parser::Thread::onTick(), crawlservpp::Module::Extractor::Thread::onTick(), crawlservpp::Module::Parser::Thread::onUnpause(), crawlservpp::Module::Extractor::Thread::onUnpause(), crawlservpp::Module::Crawler::Thread::onUnpause(), crawlservpp::Network::Curl::resetConnection(), crawlservpp::Timer::StartStop::start(), crawlservpp::Timer::StartStopHR::start(), crawlservpp::Timer::StartStop::stop(), crawlservpp::Timer::StartStopHR::stop(), crawlservpp::Timer::SimpleHR::tick(), crawlservpp::Timer::Simple::tick(), crawlservpp::Main::Server::tick(), crawlservpp::Timer::SimpleHR::tickStr(), and crawlservpp::Timer::Simple::tickStr().
|
inline |
Reduce a date to the specified resolution.
date | Reference to a string containing the date in the format YYYY-MM-DD that will be reduced to the specified resolution, if necessary. |
resolution | Resolution to be used for reducing the date. |
DateTime::Exception | if the given date/time has an invalid length, or the specified resolution is invalid. |
References dateDays, dateMonths, dateWeeks, dateYears, getYearAndWeek(), isoDateLength, reducedToMonthLength, and yearLength.
Referenced by crawlservpp::Module::Analyzer::Algo::WordsOverTime::resetAlgo(), crawlservpp::Module::Analyzer::Algo::AssocOverTime::resetAlgo(), and crawlservpp::Module::Analyzer::Algo::SentimentOverTime::resetAlgo().
void crawlservpp::Helper::DateTime::removeOrdinals | ( | const std::array< std::string_view, N > & | suffixes, |
std::string & | strInOut | ||
) |
Removes all ordinal suffixes after numbers in the given string.
suffixes | Constant reference to an array containing the suffixes to be removed from the end of numbers in the given string. |
strInOut | A reference to the string containing the date/time, from which the ordinal suffixes will be removed in situ. |
Referenced by convertCustomDateTimeToSQLTimeStamp().
void crawlservpp::Helper::DateTime::removeOrdinals | ( | std::string_view | currentLocale, |
std::string_view | localePrefix, | ||
const std::array< std::string_view, N > & | suffixes, | ||
std::string & | strInOut | ||
) |
Removes all ordinal suffixes after numbers in the given string, if the current locale matches the given locale.
currentLocale | View of a string containing the current locale. |
localePrefix | View of a string containing the language prefix of the locale of the given suffixes. |
suffixes | Constant reference to an array containing the suffixes to be removed from the end of numbers in the given string, if the current locale fits the given locale prefix. |
strInOut | A reference to the string containing the date/time, from which the ordinal suffixes will be removed in situ, if the current locale starts with the given locale prefix. |
|
inline |
Converts seconds into a well-formatted string.
seconds | The number of seconds to convert. |
References secondsPerDay, secondsPerHour, and secondsPerMinute.
Referenced by crawlservpp::Main::Database::checkConnection(), crawlservpp::Module::Thread::log(), crawlservpp::Main::Server::tick(), and crawlservpp::Main::App::~App().
|
inline |
The length of the 12-h suffix (AM
/ PM
).
Referenced by handle12hTime().
|
inline |
Base of decimal numbers.
Referenced by fixYear().
|
inline |
The two digits from which two-digit years will be interpreted as years after 2000.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Number of days in a week.
Referenced by getWeekGap().
|
inline |
The prefix for English locales.
Referenced by fixRussianMonths().
|
inline |
An array containing English ordinal suffixes to be stripped from numbers.
Referenced by convertCustomDateTimeToSQLTimeStamp().
|
inline |
The prefix for Finnish locales.
Referenced by fixFinnishMonths().
|
inline |
The prefix for French locales.
Referenced by convertCustomDateTimeToSQLTimeStamp(), and fixFrenchMonths().
|
inline |
An array containing French ordinal suffix to be stripped from numbers.
Referenced by convertCustomDateTimeToSQLTimeStamp().
|
inline |
The number of hours to be added to a PM time, or to be subtracted from a 12th hour AM
time.
Referenced by convert12hTo24h().
|
inline |
The hour of noon and midnight.
Referenced by convert12hTo24h().
|
inline |
The length of a date in valid ISO format (YYYY-MM-DD
).
Referenced by isISODateInRange(), and reduceDate().
|
inline |
The length of the month in an ISO date (YYYY-MM-DD
).
|
inline |
The position of the month in an ISO date (YYYY-MM-DD
).
|
inline |
The 'long' format for date/times.
Referenced by convertLongDateTimeToSQLTimeStamp().
|
inline |
The number of microseconds per day used for date/time formatting.
Referenced by microsecondsToString().
|
inline |
The number of microseconds per hour used for date/time formatting.
Referenced by microsecondsToString().
|
inline |
The number of microseconds per millisecond used for date/time formatting.
Referenced by microsecondsToString().
|
inline |
The number of microseconds per minute used for date/time formatting.
Referenced by microsecondsToString().
|
inline |
The number of microseconds per second used for date/time formatting.
Referenced by microsecondsToString().
|
inline |
The number of milliseconds per day used for date/time formatting.
Referenced by millisecondsToString().
|
inline |
The number of milliseconds per hour used for date/time formatting.
Referenced by millisecondsToString().
|
inline |
The number of milliseconds per minute used for date/time formatting.
Referenced by millisecondsToString().
|
inline |
The number of milliseconds per second used for date/time formatting.
Referenced by millisecondsToString().
|
inline |
Consider two-digit years before this year as being in the 2000s.
Referenced by fixYear().
|
inline |
Length of date, reduced to month (YYYY-MM
)
Referenced by reduceDate().
|
inline |
The prefix for Russian locales.
Referenced by convertCustomDateTimeToSQLTimeStamp(), and fixRussianMonths().
|
inline |
An array containing Russian ordinal suffixes to be stripped from numbers.
Referenced by convertCustomDateTimeToSQLTimeStamp().
|
inline |
The number of seconds per day used for date/time formatting.
Referenced by secondsToString().
|
inline |
The number of seconds per hour used for date/time formatting.
Referenced by secondsToString().
|
inline |
The number of seconds per minute used for date/time formatting.
Referenced by secondsToString().
|
inline |
The date/time format used by the MySQL database (as C
string).
Referenced by convertCustomDateTimeToSQLTimeStamp().
|
inline |
The length of a formatted time stamp in the MySQL database.
Referenced by convertCustomDateTimeToSQLTimeStamp().
|
inline |
The prefix for Ukrainian locales.
Referenced by convertCustomDateTimeToSQLTimeStamp(), and fixUkrainianMonths().
|
inline |
An array containing Ukrainian ordinal suffixes to be stripped from numbers.
Referenced by convertCustomDateTimeToSQLTimeStamp().
|
inline |
The keyword to use a UNIX time format.
Referenced by convertCustomDateTimeToSQLTimeStamp().
|
inline |
The keyword to use a UNIX time format minus an offset.
Referenced by convertCustomDateTimeToSQLTimeStamp().
|
inline |
The keyword to use a UNIX time format plus an offset.
Referenced by convertCustomDateTimeToSQLTimeStamp().
|
inline |
The length of the keyword to use a UNIX time format with offset.
Referenced by convertCustomDateTimeToSQLTimeStamp().
|
inline |
The position of the beginning of a UNIX time format offset.
Referenced by convertCustomDateTimeToSQLTimeStamp().
|
inline |
The length of a year.
Referenced by fixYear(), and reduceDate().
|
inline |
The number of years in a century.