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