mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-16 15:17:13 +02:00
Remove SLongInt and ULongInt helper types.
Fix a bunch of bugs and mistakes discovered along the way.
This commit is contained in:
@ -4,7 +4,6 @@
|
||||
#include "Library/Chrono/Time.hpp"
|
||||
#include "Library/Chrono/Date.hpp"
|
||||
#include "Library/Chrono/Datetime.hpp"
|
||||
#include "Library/Numeric/Long.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <chrono>
|
||||
@ -15,13 +14,6 @@ namespace SqMod {
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMOD_DECL_TYPENAME(Typename, _SC("SqTimestamp"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Timestamp::Timestamp(const SLongInt & t)
|
||||
: m_Timestamp(t.GetNum())
|
||||
{
|
||||
/* ... */
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
int32_t Timestamp::Cmp(const Timestamp & o) const
|
||||
{
|
||||
@ -52,36 +44,36 @@ void Timestamp::SetNow()
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SLongInt Timestamp::GetMicroseconds() const
|
||||
SQInteger Timestamp::GetMicroseconds() const
|
||||
{
|
||||
return SLongInt(m_Timestamp);
|
||||
return m_Timestamp;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Timestamp::SetMicroseconds(const SLongInt & amount)
|
||||
void Timestamp::SetMicroseconds(SQInteger amount)
|
||||
{
|
||||
m_Timestamp = amount.GetNum();
|
||||
m_Timestamp = amount;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Timestamp & Timestamp::AddMicroseconds(const SLongInt & amount) { m_Timestamp += amount.GetNum(); return *this; }
|
||||
Timestamp & Timestamp::SubMicroseconds(const SLongInt & amount) { m_Timestamp -= amount.GetNum(); return *this; }
|
||||
Timestamp & Timestamp::AddMicroseconds(SQInteger amount) { m_Timestamp += amount; return *this; }
|
||||
Timestamp & Timestamp::SubMicroseconds(SQInteger amount) { m_Timestamp -= amount; return *this; }
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SLongInt Timestamp::GetMilliseconds() const
|
||||
SQInteger Timestamp::GetMilliseconds() const
|
||||
{
|
||||
return SLongInt(m_Timestamp / 1000L);
|
||||
return m_Timestamp / 1000L;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Timestamp::SetMilliseconds(const SLongInt & amount)
|
||||
void Timestamp::SetMilliseconds(SQInteger amount)
|
||||
{
|
||||
m_Timestamp = (amount.GetNum() * 1000L);
|
||||
m_Timestamp = (amount * 1000L);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Timestamp & Timestamp::AddMilliseconds(const SLongInt & amount) { m_Timestamp += (amount.GetNum() * 1000L); return *this; }
|
||||
Timestamp & Timestamp::SubMilliseconds(const SLongInt & amount) { m_Timestamp -= (amount.GetNum() * 1000L); return *this; }
|
||||
Timestamp & Timestamp::AddMilliseconds(SQInteger amount) { m_Timestamp += (amount * 1000L); return *this; }
|
||||
Timestamp & Timestamp::SubMilliseconds(SQInteger amount) { m_Timestamp -= (amount * 1000L); return *this; }
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Time Timestamp::GetTime() const
|
||||
@ -213,7 +205,7 @@ static Timestamp SqGetMicrosecondsRaw(int64_t amount)
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static Timestamp SqGetMicroseconds(const SLongInt & amount)
|
||||
static Timestamp SqGetMicroseconds(SQInteger amount)
|
||||
{
|
||||
return Timestamp(amount);
|
||||
}
|
||||
|
@ -40,11 +40,6 @@ public:
|
||||
/* ... */
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
explicit Timestamp(const SLongInt & t);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
@ -122,18 +117,18 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
SQMOD_NODISCARD SLongInt GetMicroseconds() const;
|
||||
SQMOD_NODISCARD SQInteger GetMicroseconds() const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
void SetMicroseconds(const SLongInt & amount);
|
||||
void SetMicroseconds(SQInteger amount);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
Timestamp & AddMicroseconds(const SLongInt & amount);
|
||||
Timestamp & SubMicroseconds(const SLongInt & amount);
|
||||
Timestamp & AddMicroseconds(SQInteger amount);
|
||||
Timestamp & SubMicroseconds(SQInteger amount);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
*
|
||||
@ -160,18 +155,18 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
SQMOD_NODISCARD SLongInt GetMilliseconds() const;
|
||||
SQMOD_NODISCARD SQInteger GetMilliseconds() const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
void SetMilliseconds(const SLongInt & amount);
|
||||
void SetMilliseconds(SQInteger amount);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
Timestamp & AddMilliseconds(const SLongInt & amount);
|
||||
Timestamp & SubMilliseconds(const SLongInt & amount);
|
||||
Timestamp & AddMilliseconds(SQInteger amount);
|
||||
Timestamp & SubMilliseconds(SQInteger amount);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
*
|
||||
@ -244,7 +239,7 @@ public:
|
||||
*/
|
||||
SQMOD_NODISCARD SQFloat GetMinutesF() const
|
||||
{
|
||||
return SQFloat(m_Timestamp / 60000000.0);
|
||||
return SQFloat(m_Timestamp) / 60000000.0;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
@ -288,7 +283,7 @@ public:
|
||||
*/
|
||||
SQMOD_NODISCARD SQFloat GetHoursF() const
|
||||
{
|
||||
return SQFloat(m_Timestamp / 3600000000.0);
|
||||
return SQFloat(m_Timestamp) / 3600000000.0;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
@ -332,7 +327,7 @@ public:
|
||||
*/
|
||||
SQMOD_NODISCARD SQFloat GetDaysF() const
|
||||
{
|
||||
return SQFloat(m_Timestamp / 86400000000.0);
|
||||
return SQFloat(m_Timestamp) / 86400000000.0;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
@ -376,7 +371,7 @@ public:
|
||||
*/
|
||||
SQMOD_NODISCARD SQFloat GetYearsF() const
|
||||
{
|
||||
return SQFloat(m_Timestamp / 31557600000000.0);
|
||||
return SQFloat(m_Timestamp) / 31557600000000.0;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
@ -466,7 +461,7 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
std::time_t ToTimeT() const;
|
||||
SQMOD_NODISCARD std::time_t ToTimeT() const;
|
||||
|
||||
private:
|
||||
|
||||
|
Reference in New Issue
Block a user