1# 2# Copyright (C) 2015 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17header: 18summary: Time Functions and Types 19description: 20 The functions below can be used to tell the current clock time and the current 21 system up time. It is not recommended to call these functions inside of a kernel. 22end: 23 24type: rs_time_t 25size: 32 26simple: int 27summary: Seconds since January 1, 1970 28description: 29 Calendar time interpreted as seconds elapsed since the Epoch (00:00:00 on 30 January 1, 1970, Coordinated Universal Time (UTC)). 31end: 32 33type: rs_time_t 34size: 64 35simple: long 36end: 37 38type: rs_tm 39struct: 40field: int tm_sec, "Seconds after the minute. This ranges from 0 to 59, but possibly up to 60 for leap seconds." 41field: int tm_min, "Minutes after the hour. This ranges from 0 to 59." 42field: int tm_hour, "Hours past midnight. This ranges from 0 to 23." 43field: int tm_mday, "Day of the month. This ranges from 1 to 31." 44field: int tm_mon, "Months since January. This ranges from 0 to 11." 45field: int tm_year, "Years since 1900." 46field: int tm_wday, "Days since Sunday. This ranges from 0 to 6." 47field: int tm_yday, "Days since January 1. This ranges from 0 to 365." 48field: 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." 49summary: Date and time structure 50description: 51 Data structure for broken-down time components. 52end: 53 54function: rsGetDt 55ret: float, "Time in seconds." 56summary: Elapsed time since last call 57description: 58 Returns the time in seconds since this function was last called in this script. 59test: none 60end: 61 62function: rsLocaltime 63ret: rs_tm*, "Pointer to the output local time, i.e. the same value as the parameter local." 64arg: rs_tm* local, "Pointer to time structure where the local time will be stored." 65arg: const rs_time_t* timer, "Input time as a number of seconds since January 1, 1970." 66summary: Convert to local time 67description: 68 Converts the time specified by timer into a @rs_tm structure that provides year, month, 69 hour, etc. This value is stored at *local. 70 71 This functions returns the same pointer that is passed as first argument. If the 72 local parameter is NULL, this function does nothing and returns NULL. 73test: none 74end: 75 76function: rsTime 77ret: rs_time_t, "Seconds since the Epoch, -1 if there's an error." 78arg: rs_time_t* timer, "Location to also store the returned calendar time." 79summary: Seconds since January 1, 1970 80description: 81 Returns the number of seconds since the Epoch (00:00:00 UTC, January 1, 1970). 82 83 If timer is non-NULL, the result is also stored in the memory pointed to by 84 this variable. 85test: none 86end: 87 88function: rsUptimeMillis 89ret: int64_t, "Uptime in milliseconds." 90summary: System uptime in milliseconds 91description: 92 Returns the current system clock (uptime) in milliseconds. 93test: none 94end: 95 96function: rsUptimeNanos 97ret: int64_t, "Uptime in nanoseconds." 98summary: System uptime in nanoseconds 99description: 100 Returns the current system clock (uptime) in nanoseconds. 101 102 The granularity of the values return by this call may be much larger than a nanosecond. 103test: none 104end: 105