 |
Gorgon Game Engine
|
Go to the documentation of this file.
9 namespace Gorgon {
namespace Time {
40 Timer(
unsigned passed=0) : passed(passed) {
57 passed+=current-lasttick;
66 unsigned Get()
const {
71 void Set(
unsigned passed) {
79 operator unsigned()
const {
94 void ShowDialog(
const std::string &name =
"Time passed",
95 const std::string &title=
"Performance timer")
const;
void AddMonths(int months)
Adds specified amount of months to the date.
Definition: Time.cpp:359
unsigned Get() const
Returns total time passed.
Definition: Timer.h:66
@ Saturday
Definition: Time.h:36
tm totm(const Date &d)
Definition: Time.cpp:20
Timer & Tick()
Counts the time since the last Start, Tick, Set, Reset or from the contruction of the timer and adds ...
Definition: Timer.h:54
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
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
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
void Set(unsigned passed)
Changes the passed time. Adjusts starting time of the timer.
Definition: Timer.h:71
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
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 int Minute
Minute.
Definition: Time.h:214
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
bool Load(std::istream &source)
Loads date object from a binary stream.
Definition: Time.cpp:83
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
std::string Trim(std::string str, const std::string &chars=" \t\n\r")
Strips whitespace around the given string both from start and end.
Definition: String.h:370
@ 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
void ShowDialog(const std::string &name="Time passed", const std::string &title="Performance timer") const
Shows a UI dialog displaying the amount of time passed.
Definition: Time.cpp:410
std::string Timezone_GMT() const
Returns stored timezone.
Definition: Time.cpp:284
unsigned int Day
Day in month.
Definition: Time.h:205
MonthType
Months, january is 1.
Definition: Time.h:40
int Timezone
Timezone in minutes, can be negative.
Definition: Time.h:224
void Start()
Starts the timer from this instant.
Definition: Timer.h:46
Millisecond based timer.
Definition: Timer.h:32
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
unsigned char Byte
Represents smallest cell in memory.
Definition: Types.h:9
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
void fromtm(Date &ret, tm timeinfo)
Definition: Time.cpp:34
std::string Time() const
Returns stored time in hour:minute:second format.
Definition: Time.cpp:264
unsigned int Second
Second.
Definition: Time.h:217
Timer(unsigned passed=0)
Default constructor.
Definition: Timer.h:40
friend std::ostream & operator<<(std::ostream &output, const Timer &timer)
Allows Timer to be printed.
Definition: Timer.h:103
void Initialize()
Initializes Time module.
Definition: Time.cpp:15
void Reset()
Resets the passed time. Adjusts starting time of the timer.
Definition: Timer.h:84
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
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
void AddHours(int hours)
Adds specified amount of hours to the date.
Definition: Time.cpp:377
void AddMinutes(int minutes)
Adds specified amount of minutes to the date.
Definition: Time.cpp:386