Files
botw/lib/sead/include/time/seadDateTime.h
T
Léo Lam 18c60323a9 Switch to subrepos
git subrepo clone https://github.com/open-ead/sead lib/sead

subrepo:
  subdir:   "lib/sead"
  merged:   "1b66e825d"
upstream:
  origin:   "https://github.com/open-ead/sead"
  branch:   "master"
  commit:   "1b66e825d"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

git subrepo clone (merge) https://github.com/open-ead/nnheaders lib/NintendoSDK

subrepo:
  subdir:   "lib/NintendoSDK"
  merged:   "9ee21399f"
upstream:
  origin:   "https://github.com/open-ead/nnheaders"
  branch:   "master"
  commit:   "9ee21399f"
git-subrepo:
  version:  "0.4.3"
  origin:   "ssh://git@github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

git subrepo clone https://github.com/open-ead/agl lib/agl

subrepo:
  subdir:   "lib/agl"
  merged:   "7c063271b"
upstream:
  origin:   "https://github.com/open-ead/agl"
  branch:   "master"
  commit:   "7c063271b"
git-subrepo:
  version:  "0.4.3"
  origin:   "ssh://git@github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

git subrepo clone https://github.com/open-ead/EventFlow lib/EventFlow

subrepo:
  subdir:   "lib/EventFlow"
  merged:   "c35d21b34"
upstream:
  origin:   "https://github.com/open-ead/EventFlow"
  branch:   "master"
  commit:   "c35d21b34"
git-subrepo:
  version:  "0.4.3"
  origin:   "ssh://git@github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"
2022-03-21 21:31:42 +01:00

99 lines
2.9 KiB
C++

#pragma once
#include "basis/seadTypes.h"
#include "time/seadCalendarTime.h"
#include "time/seadDateSpan.h"
namespace sead
{
class DateTimeUtc;
class DateTime
{
public:
DateTime(u64 unix_time);
DateTime(const CalendarTime& time);
DateTime(const CalendarTime::Year& year, const CalendarTime::Month& month,
const CalendarTime::Day& day, const CalendarTime::Hour& hour,
const CalendarTime::Minute& minute, const CalendarTime::Second& second);
DateTime& operator+=(DateSpan span)
{
mUnixTime += span.getSpan();
return *this;
}
DateTime& operator-=(DateSpan span)
{
mUnixTime -= span.getSpan();
return *this;
}
u64 setNow();
void setUnixTime(u64 unix_time) { mUnixTime = unix_time; }
u64 setUnixTime(const CalendarTime& time);
u64 setUnixTime(const CalendarTime::Year& year, const CalendarTime::Month& month,
const CalendarTime::Day& day, const CalendarTime::Hour& hour,
const CalendarTime::Minute& minute, const CalendarTime::Second& second);
u64 getUnixTime() const { return mUnixTime; }
void getCalendarTime(CalendarTime* time) const;
DateSpan diff(DateTime time) const;
DateSpan diffToNow() const;
static void initializeSystemTimeModule();
protected:
static bool mIsInitialized;
u64 mUnixTime;
};
DateSpan operator-(DateTime lhs, DateTime rhs);
DateTime operator-(DateTime time, DateSpan span);
DateTime operator+(DateTime time, DateSpan span);
class DateTimeUtc
{
public:
DateTimeUtc(u64 unix_time);
DateTimeUtc(const DateTime& time);
DateTimeUtc(const CalendarTime& time);
DateTimeUtc(const CalendarTime::Year& year, const CalendarTime::Month& month,
const CalendarTime::Day& day, const CalendarTime::Hour& hour,
const CalendarTime::Minute& minute, const CalendarTime::Second& second);
DateTimeUtc& operator+=(DateSpan span)
{
mUnixTime += span.getSpan();
return *this;
}
DateTimeUtc& operator-=(DateSpan span)
{
mUnixTime -= span.getSpan();
return *this;
}
u64 setNow();
void setUnixTime(u64 unix_time) { mUnixTime = unix_time; }
u64 setUnixTime(const CalendarTime& time);
u64 setUnixTime(const CalendarTime::Year& year, const CalendarTime::Month& month,
const CalendarTime::Day& day, const CalendarTime::Hour& hour,
const CalendarTime::Minute& minute, const CalendarTime::Second& second);
u64 getUnixTime() const { return mUnixTime; }
void getCalendarTime(CalendarTime* time) const;
DateSpan diff(DateTimeUtc time) const;
DateSpan diffToNow() const;
protected:
u64 mUnixTime;
};
DateSpan operator-(DateTimeUtc lhs, DateTimeUtc rhs);
DateTimeUtc operator-(DateTimeUtc time, DateSpan span);
DateTimeUtc operator+(DateTimeUtc time, DateSpan span);
} // namespace sead