25 #include "common/scummsys.h" 32 Time() { _milliseconds = 0; }
33 Time(
const uint32 &t) { _milliseconds = t; }
36 explicit operator uint32()
const {
return _milliseconds; }
37 Time &operator=(
const Time &t) {
if (
this != &t) _milliseconds = t._milliseconds;
return *
this; }
38 Time &operator=(
const uint32 &t) { _milliseconds = t;
return *
this; }
39 Time &operator+=(
const Time &t) { _milliseconds += t._milliseconds;
return *
this; }
40 Time &operator+=(
const uint32 &t) { _milliseconds+=t;
return *
this; }
41 Time &operator-=(
const Time &t) { _milliseconds -= t._milliseconds;
return *
this; }
42 Time &operator-=(
const uint32 &t) { _milliseconds-=t;
return *
this; }
44 friend Time operator+(
Time l,
const Time &r) { l += r;
return l; }
45 friend Time operator+(
Time l,
const uint32 &r) { l += r;
return l; }
46 friend Time operator+(
const uint32 &l,
Time r) { r += l;
return r; }
47 friend Time operator-(
Time l,
const Time &r) { l -= r;
return l; }
48 friend Time operator-(
Time l,
const uint32 &r) { l -= r;
return l; }
49 friend Time operator-(
const uint32 &l,
Time r) { r -= l;
return r; }
51 friend bool operator== (
const Time &l,
const Time &r) {
return l._milliseconds == r._milliseconds; }
52 friend bool operator== (
const Time &l,
const uint32 &r) {
return l._milliseconds == r; }
53 friend bool operator== (
const uint32 &l,
const Time &r) {
return l == r._milliseconds; }
54 friend bool operator!= (
const Time &l,
const Time &r) {
return l._milliseconds != r._milliseconds; }
55 friend bool operator!= (
const Time &l,
const uint32 &r) {
return l._milliseconds != r; }
56 friend bool operator!= (
const uint32 &l,
const Time &r) {
return l != r._milliseconds; }
57 friend bool operator< (
const Time &l,
const Time &r) {
return l._milliseconds < r._milliseconds; }
58 friend bool operator< (
const Time &l,
const uint32 &r) {
return l._milliseconds < r; }
59 friend bool operator< (
const uint32 &l,
const Time &r) {
return l < r._milliseconds; }
60 friend bool operator> (
const Time &l,
const Time &r) {
return r < l; }
61 friend bool operator> (
const Time &l,
const uint32 &r) {
return r < l; }
62 friend bool operator> (
const uint32 &l,
const Time &r) {
return r < l; }
63 friend bool operator<= (
const Time &l,
const Time &r) {
return !(l > r); }
64 friend bool operator<= (
const Time &l,
const uint32 &r) {
return !(l > r); }
65 friend bool operator<= (
const uint32 &l,
const Time &r) {
return !(l > r); }
66 friend bool operator>= (
const Time &l,
const Time &r) {
return !(l < r); }
67 friend bool operator>= (
const Time &l,
const uint32 &r) {
return !(l < r); }
68 friend bool operator>= (
const uint32 &l,
const Time &r) {
return !(l < r); }
70 uint16 getSeconds()
const {
return (_milliseconds / 1000) % 60; }
71 uint16 getMinutes()
const {
return (_milliseconds / 60000) % 60; }
72 uint16 getTotalHours()
const {
return _milliseconds / 3600000; }
74 uint16 getHours()
const {
return (_milliseconds / 3600000) % 24; }
75 uint16 getDays()
const {
return _milliseconds / 86400000; }
83 #endif // NANCY_TIME_H
Definition: actionmanager.h:32