 |
Gorgon Game Engine
|
Go to the documentation of this file.
64 Date(
const std::string &isodate) {
if(!
Parse(isodate))
throw std::runtime_error(
"Invalid date"); }
68 Date(std::istream &source) {
if(!
Load(source))
throw std::runtime_error(
"Invalid date"); }
77 bool Save(std::ostream &target);
81 bool Load(std::istream &source);
97 bool Parse(std::string isodate);
103 std::string
ISODateTime(
bool timezone =
true)
const;
132 std::string
Time()
const;
void AddMonths(int months)
Adds specified amount of months to the date.
Definition: Time.cpp:359
@ Thursday
Definition: Time.h:34
@ Saturday
Definition: Time.h:36
Date GetDate()
Returns the current date.
Definition: Linux.cpp:9
@ Agu
Definition: Time.h:49
Date(std::istream &source)
Reads a new date object from a binary stream.
Definition: Time.h:68
@ May
Definition: Time.h:46
unsigned long framestart
Definition: Time.cpp:406
std::string ISODate() const
ISO compliant date format. Contains only date.
Definition: Time.cpp:147
unsigned long GetTime()
Returns current time in milliseconds.
Definition: Linux.cpp:34
@ Empty
Definition: Time.h:41
WeekdayType
Days of week. Starts from sunday.
Definition: Time.h:29
const std::string & ShortWeekdayName_En() const
Returns currently stored week day's int name in English.
Definition: Time.cpp:233
@ Oct
Definition: Time.h:51
std::ostream & operator<<(std::ostream &out, const Date &date)
Output stream operator overload.
Definition: Time.h:228
unsigned long deltatime
Definition: Time.cpp:407
double operator-(const Date &other)
Gives the difference between two dates.
Definition: Time.cpp:332
@ Jun
Definition: Time.h:47
static int LocalTimezone()
Returns the system timezone in minutes. Might be negative.
Definition: Time.cpp:306
unsigned int Millisecond
This value is from the last second tick.
Definition: Time.h:220
Date(const std::string &isodate)
Creates a new date object from the given ISO-8601 date string.
Definition: Time.h:64
unsigned int Hour
Hour in 24 hour format.
Definition: Time.h:211
std::string ShortTime() const
Returns stored time in hour:minute format.
Definition: Time.cpp:274
const std::string & ShortMonthName_En() const
Returns currently stored month's int name in English.
Definition: Time.cpp:202
unsigned long DeltaTime()
Returns the time passed since the last frame.
Definition: Time.h:258
@ Sunday
Definition: Time.h:30
unsigned int Minute
Minute.
Definition: Time.h:214
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
void Unset()
Unsets the stored time.
Definition: Time.h:182
bool Load(std::istream &source)
Loads date object from a binary stream.
Definition: Time.cpp:83
@ Tuesday
Definition: Time.h:32
MonthType Month
Month starts from jan = 1.
Definition: Time.h:202
bool Save(std::ostream &target)
Writes date object to a binary stream.
Definition: Time.cpp:112
@ Monday
Definition: Time.h:31
@ Dec
Definition: Time.h:53
std::string ISODateTime(bool timezone=true) const
ISO compliant date/time. This format should be used to serialize as text.
Definition: Time.cpp:160
std::string ShortDate_En() const
Returns stored date in day intmonthname year format with English names for month.
Definition: Time.cpp:256
std::string Timezone_GMT() const
Returns stored timezone.
Definition: Time.cpp:284
unsigned int Day
Day in month.
Definition: Time.h:205
@ Mar
Definition: Time.h:44
MonthType
Months, january is 1.
Definition: Time.h:40
static Date Now()
Returns current time.
Definition: Time.h:171
int Timezone
Timezone in minutes, can be negative.
Definition: Time.h:224
@ Friday
Definition: Time.h:35
bool Parse(std::string isodate)
Creates a new date object from the given ISO-8601 date string.
Definition: Time.cpp:44
This class represents a specific date including time information.
Definition: Time.h:26
@ Wednesday
Definition: Time.h:33
@ Nov
Definition: Time.h:52
void AddSeconds(int seconds)
Adds specified amount of seconds to the date.
Definition: Time.cpp:395
WeekdayType Weekday
Day of the week, starts from sunday = 0.
Definition: Time.h:208
A class that has no members and can be used as placeholder.
Definition: Types.h:51
@ Apr
Definition: Time.h:45
std::string Time() const
Returns stored time in hour:minute:second format.
Definition: Time.cpp:264
unsigned int Second
Second.
Definition: Time.h:217
void Initialize()
Initializes Time module.
Definition: Time.cpp:15
const std::string & WeekdayName_En() const
Returns currently stored week day's name in English.
Definition: Time.cpp:219
void AddDays(int days)
Adds specified amount of days to the date.
Definition: Time.cpp:368
bool DetermineWeekday()
Determines the weekday from the stored date.
Definition: Time.cpp:319
unsigned long FrameStart()
Returns start time of the current frame in milliseconds.
Definition: Time.h:252
const std::string & MonthName_En() const
Returns currently stored month's name in English.
Definition: Time.cpp:185
bool operator==(const Date &other) const
Compares 2 dates.
Definition: Time.cpp:341
void AddYears(int years)
Adds specified amount of years to the date.
Definition: Time.cpp:350
std::string Date_En() const
Returns stored date in day monthname year, weekday format with English names for month and weekday.
Definition: Time.cpp:247
unsigned int Year
Full year.
Definition: Time.h:199
@ Jul
Definition: Time.h:48
void AddHours(int hours)
Adds specified amount of hours to the date.
Definition: Time.cpp:377
@ Feb
Definition: Time.h:43
bool IsSet() const
Checks whether the stored time is actually set.
Definition: Time.h:166
Date()
Default constructor, zero initializes the class, making it an unset time.
Definition: Time.h:58
@ Sep
Definition: Time.h:50
@ Jan
Definition: Time.h:42
void AddMinutes(int minutes)
Adds specified amount of minutes to the date.
Definition: Time.cpp:386