Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 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 | |
| 17 | header: |
Jean-Luc Brouillet | 20b27d6 | 2015-04-03 14:39:53 -0700 | [diff] [blame] | 18 | summary: Time Functions and Types |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 19 | description: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 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. |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 22 | end: |
| 23 | |
| 24 | type: rs_time_t |
| 25 | size: 32 |
| 26 | simple: int |
| 27 | summary: Seconds since January 1, 1970 |
| 28 | description: |
| 29 | Calendar time interpreted as seconds elapsed since the Epoch (00:00:00 on |
| 30 | January 1, 1970, Coordinated Universal Time (UTC)). |
| 31 | end: |
| 32 | |
| 33 | type: rs_time_t |
| 34 | size: 64 |
| 35 | simple: long |
| 36 | end: |
| 37 | |
| 38 | type: rs_tm |
| 39 | struct: |
| 40 | field: int tm_sec, "Seconds after the minute. This ranges from 0 to 59, but possibly up to 60 for leap seconds." |
| 41 | field: int tm_min, "Minutes after the hour. This ranges from 0 to 59." |
| 42 | field: int tm_hour, "Hours past midnight. This ranges from 0 to 23." |
| 43 | field: int tm_mday, "Day of the month. This ranges from 1 to 31." |
| 44 | field: int tm_mon, "Months since January. This ranges from 0 to 11." |
| 45 | field: int tm_year, "Years since 1900." |
| 46 | field: int tm_wday, "Days since Sunday. This ranges from 0 to 6." |
| 47 | field: int tm_yday, "Days since January 1. This ranges from 0 to 365." |
| 48 | field: 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." |
| 49 | summary: Date and time structure |
| 50 | description: |
| 51 | Data structure for broken-down time components. |
| 52 | end: |
| 53 | |
| 54 | function: rsGetDt |
| 55 | ret: float, "Time in seconds." |
Jean-Luc Brouillet | 20b27d6 | 2015-04-03 14:39:53 -0700 | [diff] [blame] | 56 | summary: Elapsed time since last call |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 57 | description: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 58 | Returns the time in seconds since this function was last called in this script. |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 59 | test: none |
| 60 | end: |
| 61 | |
| 62 | function: rsLocaltime |
Jean-Luc Brouillet | 20b27d6 | 2015-04-03 14:39:53 -0700 | [diff] [blame] | 63 | ret: rs_tm*, "Pointer to the output local time, i.e. the same value as the parameter local." |
| 64 | arg: rs_tm* local, "Pointer to time structure where the local time will be stored." |
| 65 | arg: const rs_time_t* timer, "Input time as a number of seconds since January 1, 1970." |
| 66 | summary: Convert to local time |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 67 | description: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 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. |
Jean-Luc Brouillet | 20b27d6 | 2015-04-03 14:39:53 -0700 | [diff] [blame] | 70 | |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 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. |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 73 | test: none |
| 74 | end: |
| 75 | |
| 76 | function: rsTime |
Jean-Luc Brouillet | 20b27d6 | 2015-04-03 14:39:53 -0700 | [diff] [blame] | 77 | ret: rs_time_t, "Seconds since the Epoch, -1 if there's an error." |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 78 | arg: rs_time_t* timer, "Location to also store the returned calendar time." |
Jean-Luc Brouillet | 20b27d6 | 2015-04-03 14:39:53 -0700 | [diff] [blame] | 79 | summary: Seconds since January 1, 1970 |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 80 | description: |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 81 | Returns the number of seconds since the Epoch (00:00:00 UTC, January 1, 1970). |
Jean-Luc Brouillet | 20b27d6 | 2015-04-03 14:39:53 -0700 | [diff] [blame] | 82 | |
| 83 | If timer is non-NULL, the result is also stored in the memory pointed to by |
| 84 | this variable. |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 85 | test: none |
| 86 | end: |
| 87 | |
| 88 | function: rsUptimeMillis |
| 89 | ret: int64_t, "Uptime in milliseconds." |
Jean-Luc Brouillet | 20b27d6 | 2015-04-03 14:39:53 -0700 | [diff] [blame] | 90 | summary: System uptime in milliseconds |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 91 | description: |
| 92 | Returns the current system clock (uptime) in milliseconds. |
| 93 | test: none |
| 94 | end: |
| 95 | |
| 96 | function: rsUptimeNanos |
| 97 | ret: int64_t, "Uptime in nanoseconds." |
Jean-Luc Brouillet | 20b27d6 | 2015-04-03 14:39:53 -0700 | [diff] [blame] | 98 | summary: System uptime in nanoseconds |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 99 | description: |
| 100 | Returns the current system clock (uptime) in nanoseconds. |
Jean-Luc Brouillet | 20b27d6 | 2015-04-03 14:39:53 -0700 | [diff] [blame] | 101 | |
Jean-Luc Brouillet | 6386ceb | 2015-04-28 15:06:30 -0700 | [diff] [blame] | 102 | The granularity of the values return by this call may be much larger than a nanosecond. |
Jean-Luc Brouillet | c5184e2 | 2015-03-13 13:51:24 -0700 | [diff] [blame] | 103 | test: none |
| 104 | end: |