Decompile 10 functions in Source/Utility/Timestamp.cpp, Source/Utility/Timestamp.h
Batch #830 by ragnarok-clanker: 0 byte-identical, 10 confirmed by peer review. - fn_18085 Timestamp::ToSqlTimestamp: logic confirmed by peer review - fn_18086 Timestamp::IsBefore: logic confirmed by peer review - fn_18087 Timestamp::IsBeforeNow: logic confirmed by peer review - fn_18088 Timestamp::Day: logic confirmed by peer review - fn_18089 Timestamp::Hour: logic confirmed by peer review - fn_18090 Timestamp::Minute: logic confirmed by peer review - fn_18091 Timestamp::Month: logic confirmed by peer review - fn_18092 Timestamp::Second: logic confirmed by peer review - fn_18093 Timestamp::Year: logic confirmed by peer review - fn_18094 Timestamp::SetDate: logic confirmed by peer review Reviewed-by: ragnarok-clanker
This commit is contained in:
parent
820df68d42
commit
740b67081d
1 changed files with 61 additions and 0 deletions
|
|
@ -4,12 +4,73 @@
|
|||
Timestamp::~Timestamp() {
|
||||
}
|
||||
|
||||
// FUNCTION: fn_18085
|
||||
TIMESTAMP_STRUCT Timestamp::ToSqlTimestamp() {
|
||||
TIMESTAMP_STRUCT result{};
|
||||
if (this->seconds < 0) {
|
||||
this->seconds = 0;
|
||||
}
|
||||
|
||||
const std::tm* local = _localtime32(&this->seconds);
|
||||
result.fraction = 0;
|
||||
result.year = static_cast<SQLSMALLINT>(local->tm_year + 1900);
|
||||
result.month = static_cast<SQLUSMALLINT>(local->tm_mon + 1);
|
||||
result.day = static_cast<SQLUSMALLINT>(local->tm_mday);
|
||||
result.hour = static_cast<SQLUSMALLINT>(local->tm_hour);
|
||||
result.minute = static_cast<SQLUSMALLINT>(local->tm_min);
|
||||
result.second = static_cast<SQLUSMALLINT>(local->tm_sec);
|
||||
return result;
|
||||
}
|
||||
|
||||
// FUNCTION: fn_18086
|
||||
int Timestamp::IsBefore(__time32_t other) const {
|
||||
return _difftime32(this->seconds, other) < 0.0;
|
||||
}
|
||||
|
||||
// FUNCTION: fn_18087
|
||||
int Timestamp::IsBeforeNow() const {
|
||||
__time32_t now;
|
||||
_time32(&now);
|
||||
return _difftime32(this->seconds, now) < 0.0;
|
||||
}
|
||||
|
||||
// FUNCTION: fn_18088
|
||||
int Timestamp::Day() const {
|
||||
return _localtime32(&this->seconds)->tm_mday;
|
||||
}
|
||||
|
||||
// FUNCTION: fn_18089
|
||||
int Timestamp::Hour() const {
|
||||
return _localtime32(&this->seconds)->tm_hour;
|
||||
}
|
||||
|
||||
// FUNCTION: fn_18090
|
||||
int Timestamp::Minute() const {
|
||||
return _localtime32(&this->seconds)->tm_min;
|
||||
}
|
||||
|
||||
// FUNCTION: fn_18091
|
||||
int Timestamp::Month() const {
|
||||
return _localtime32(&this->seconds)->tm_mon + 1;
|
||||
}
|
||||
|
||||
// FUNCTION: fn_18092
|
||||
int Timestamp::Second() const {
|
||||
return _localtime32(&this->seconds)->tm_sec;
|
||||
}
|
||||
|
||||
// FUNCTION: fn_18093
|
||||
int Timestamp::Year() const {
|
||||
return _localtime32(&this->seconds)->tm_year + 1900;
|
||||
}
|
||||
|
||||
// FUNCTION: fn_18094
|
||||
__time32_t Timestamp::SetDate(short year, short month, short day, short hour) {
|
||||
std::tm local{};
|
||||
local.tm_hour = hour;
|
||||
local.tm_mday = day;
|
||||
local.tm_mon = month - 1;
|
||||
local.tm_year = year - 1900;
|
||||
this->seconds = _mktime32(&local);
|
||||
return this->seconds;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue