Time class.
More...
◆ cTime() [1/3]
Constructor for presetting the stored time.
- Parameters
-
nHour | The hour. |
nMinute | The minute. |
nSecond | The second. |
nMicroseconds | The microsecond. |
◆ cTime() [2/3]
Constructor for presetting the stored time.
- Parameters
-
◆ cTime() [3/3]
Copy constructor.
- Parameters
-
◆ Format()
Creates a string representation of the stored time.
- Parameters
-
strFormat | The format of the string representation (see cDateTime::Format, can be empty). |
- Returns
- A string representation of the stored date.
◆ FromTimeStamp()
Converts a given timestamp into a time.
- Parameters
-
[in] | tmTime | Contains the given time as timestamp in microseconds. |
- Returns
- An object corresponding to tmTime.
◆ Get()
Fills a time structure with the stored values.
- Parameters
-
psTime | The structure to fill. |
- Returns
- void
- This method is real-time safe.\nSee @ref page_real_time_safe.\n
◆ GetCurrentSystemTime()
static cTime GetCurrentSystemTime |
( |
| ) |
|
|
static |
Get the current time (in UTC format).
- Returns
- The current time.
◆ GetCurrentTime()
static cTime GetCurrentTime |
( |
| ) |
|
|
static |
Get the current time (hardware clock with respect to timezone).
- Returns
- The current time.
◆ GetHour()
Get the hour.
- Returns
- The hour.
- This method is real-time safe.\nSee @ref page_real_time_safe.\n
◆ GetMinute()
Get the minute.
- Returns
- The minute.
- This method is real-time safe.\nSee @ref page_real_time_safe.\n
◆ GetSecond()
Get the second.
- Returns
- The second.
- This method is real-time safe.\nSee @ref page_real_time_safe.\n
◆ GetTimeFromString()
Converts a given time string into a time and fill the given time.
This string formats are supported: HH:MM:SS
-
HH
Hour in 24-hour format (zero-padded 00..23)
-
MM
Minute as decimal number (zero-padded 00..59)
-
SS
Second as decimal number (zero-padded 00..59)
-
: Separator for hour:minute:second
- Parameters
-
[out] | oTime | The time to fill according to the given time string. |
[in] | strTime | The string contains the given time as string. |
- Return values
-
ERR_INVALID_ARG | The time string length is 0 or any unsupported character was found. |
ERR_UNKNOWN_FORMAT | The time string format is invalid (e.g. H:MM:SS). |
ERR_OUT_OF_RANGE | The time is invalid (see cTime::Valid). |
ERR_NOERROR | |
◆ Microseconds()
tInt Microseconds |
( |
| ) |
const |
Get the microsecond.
- Returns
- The microsecond.
- This method is real-time safe.\nSee @ref page_real_time_safe.\n
◆ operator=()
The cTime assignment (=) operator reinitializes an existing cTime object with new data.
- Parameters
-
oTime | [in] cTime object to be assigned. |
- Returns
- Reference to accessed cTime object.
◆ Set() [1/3]
Sets the stored time.
- Parameters
-
- Returns
- void
- This method is real-time safe.\nSee @ref page_real_time_safe.\n
◆ Set() [2/3]
Sets the stored time.
- Parameters
-
- Returns
- void
- This method is real-time safe.\nSee @ref page_real_time_safe.\n
◆ Set() [3/3]
Sets the stored time.
- Parameters
-
nHour | The hour. |
nMinute | The minute. |
nSecond | The second. |
nMicroseconds | The microsecond. |
- Returns
- void
- This method is real-time safe.\nSee @ref page_real_time_safe.\n
◆ SetHour()
Set the hour.
- Parameters
-
- Returns
- void
- This method is real-time safe.\nSee @ref page_real_time_safe.\n
◆ SetMicroseconds()
Set the microsecond.
- Parameters
-
nMicroseconds | The microsecond. |
- Returns
- void
- This method is real-time safe.\nSee @ref page_real_time_safe.\n
◆ SetMinute()
Set the minute.
- Parameters
-
- Returns
- void
- This method is real-time safe.\nSee @ref page_real_time_safe.\n
◆ SetSecond()
Set the second.
- Parameters
-
- Returns
- void
- This method is real-time safe.\nSee @ref page_real_time_safe.\n
◆ TimeDiff() [1/2]
Calculates the difference between two time strings.
- Note
- The second time has to be later on first time. Daylight-saving time within the two times is not supported.
- Parameters
-
[in] | str | The format string of the output. |
The formatting codes are listed below:
-
H
Difference between two times in hours
-
M
Difference between two times in minutes
-
S
Difference between two times in seconds
- Parameters
-
[in] | strTime1 | The string contains the first time as string. |
[in] | strTime2 | The string contains the second time as string. |
- Return values
-
ERR_INVALID_ARG | The output format string length is 0 or any unsupported character was found. |
ERR_OUT_OF_RANGE | The first or second time is invalid (see cTime::Valid). |
ERR_NOT_SUPPORTED | First time is later on second time. |
- Returns
- The difference between two times according to the output format string.
◆ TimeDiff() [2/2]
Calculates the difference between two times.
- Note
- The second time has to be later on first time. Daylight-saving time within the two times is not supported.
- Parameters
-
[in] | str | The format string of the output. |
The formatting codes are listed below:
-
H
Difference between two times in hours
-
M
Difference between two times in minutes
-
S
Difference between two times in seconds
- Parameters
-
[in] | oTime1 | The first time. |
[in] | oTime2 | The second time. |
- Return values
-
ERR_INVALID_ARG | The output format string length is 0 or any unsupported character was found. |
ERR_OUT_OF_RANGE | The first or second time is invalid (see cTime::Valid). |
ERR_NOT_SUPPORTED | First time is later on second time. |
- Returns
- The difference between two times according to the output format string.
◆ Valid()
Check whether or not the stored time is valid.
Range table:
-
Houre
(00..23)
-
Minute
(00..59)
-
Second
(00..59)
-
Microseconds
(0..999999)
- Returns
- Whether or not the specified time is valid.