Home | History | Annotate | Download | only in script_api
      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:
     18 summary: Time Functions and Types
     19 description:
     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.
     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."
     56 summary: Elapsed time since last call
     57 description:
     58  Returns the time in seconds since this function was last called in this script.
     59 test: none
     60 end:
     61 
     62 function: rsLocaltime
     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
     67 description:
     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.
     73 test: none
     74 end:
     75 
     76 function: rsTime
     77 ret: rs_time_t, "Seconds since the Epoch, -1 if there's an error."
     78 arg: rs_time_t* timer, "Location to also store the returned calendar time."
     79 summary: Seconds since January 1, 1970
     80 description:
     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.
     85 test: none
     86 end:
     87 
     88 function: rsUptimeMillis
     89 ret: int64_t, "Uptime in milliseconds."
     90 summary: System uptime in milliseconds
     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."
     98 summary: System uptime in nanoseconds
     99 description:
    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.
    103 test: none
    104 end:
    105