page.title=RenderScript Time Functions and Types @jd:body
The functions below can be used to tell the current clock time and the current system up time. It is not recommended to call these functions inside of a kernel.
Types | |
---|---|
rs_time_t | Seconds since January 1, 1970 |
rs_tm | Date and time structure |
Functions | |
---|---|
rsGetDt | Elapsed time since last call |
rsLocaltime | Convert to local time |
rsTime | Seconds since January 1, 1970 |
rsUptimeMillis | System uptime in milliseconds |
rsUptimeNanos | System uptime in nanoseconds |
A typedef of: int When compiling for 32 bits.
A typedef of: long When compiling for 64 bits.
Calendar time interpreted as seconds elapsed since the Epoch (00:00:00 on January 1, 1970, Coordinated Universal Time (UTC)).
A structure with the following fields:
int tm_sec | Seconds after the minute. This ranges from 0 to 59, but possibly up to 60 for leap seconds. |
---|---|
int tm_min | Minutes after the hour. This ranges from 0 to 59. |
int tm_hour | Hours past midnight. This ranges from 0 to 23. |
int tm_mday | Day of the month. This ranges from 1 to 31. |
int tm_mon | Months since January. This ranges from 0 to 11. |
int tm_year | Years since 1900. |
int tm_wday | Days since Sunday. This ranges from 0 to 6. |
int tm_yday | Days since January 1. This ranges from 0 to 365. |
int tm_isdst | Flag to indicate whether daylight saving time is in effect. The value is positive if it is in effect, zero if it is not, and negative if the information is not available. |
Data structure for broken-down time components.
float rsGetDt(); |
Time in seconds. |
Returns the time in seconds since this function was last called in this script.
local | Pointer to time structure where the local time will be stored. |
---|---|
timer | Input time as a number of seconds since January 1, 1970. |
Pointer to the output local time, i.e. the same value as the parameter local. |
Converts the time specified by timer into a rs_tm structure that provides year, month, hour, etc. This value is stored at *local.
This functions returns the same pointer that is passed as first argument. If the local parameter is NULL, this function does nothing and returns NULL.
timer | Location to also store the returned calendar time. |
---|
Seconds since the Epoch, -1 if there's an error. |
Returns the number of seconds since the Epoch (00:00:00 UTC, January 1, 1970).
If timer is non-NULL, the result is also stored in the memory pointed to by this variable.
int64_t rsUptimeMillis(); |
Uptime in milliseconds. |
Returns the current system clock (uptime) in milliseconds.
int64_t rsUptimeNanos(); |
Uptime in nanoseconds. |
Returns the current system clock (uptime) in nanoseconds.
The granularity of the values return by this call may be much larger than a nanosecond.