Splat some unfinished code that made it into the previous commit.

This commit is contained in:
Sadie Powell 2025-03-01 16:28:47 +00:00
parent 32a127d2e0
commit 70716c5c0d
2 changed files with 4 additions and 5 deletions

View File

@ -29,10 +29,9 @@ namespace Duration
* seconds. If called with this duration 33,019,565 will be returned. * seconds. If called with this duration 33,019,565 will be returned.
* *
* @param str A string containing a duration. * @param str A string containing a duration.
* @param base The base time to use for leap year calculation.
* @return Either the number of seconds in the duration or 0 on error. * @return Either the number of seconds in the duration or 0 on error.
*/ */
CoreExport unsigned long From(const std::string& str, time_t base = 0); CoreExport unsigned long From(const std::string& str);
/** Determines whether a duration string is valid. /** Determines whether a duration string is valid.
* @param str The duration string to check. * @param str The duration string to check.
@ -58,7 +57,7 @@ namespace Duration
* @param base The base time to use for leap year calculation. * @param base The base time to use for leap year calculation.
* @return True if the conversion succeeded; otherwise, false. * @return True if the conversion succeeded; otherwise, false.
*/ */
CoreExport bool TryFrom(const std::string& str, unsigned long& duration, time_t base = 0); CoreExport bool TryFrom(const std::string& str, unsigned long& duration);
} }
namespace Time namespace Time

View File

@ -403,7 +403,7 @@ static constexpr unsigned int duration_multi[] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}; };
bool Duration::TryFrom(const std::string& str, unsigned long& duration, time_t base) bool Duration::TryFrom(const std::string& str, unsigned long& duration)
{ {
unsigned long total = 0; unsigned long total = 0;
unsigned long subtotal = 0; unsigned long subtotal = 0;
@ -437,7 +437,7 @@ bool Duration::TryFrom(const std::string& str, unsigned long& duration, time_t b
return true; return true;
} }
unsigned long Duration::From(const std::string& str, time_t base) unsigned long Duration::From(const std::string& str)
{ {
unsigned long out = 0; unsigned long out = 0;
Duration::TryFrom(str, out, base); Duration::TryFrom(str, out, base);