1/*
2 * Copyright (C) 2016 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// Don't edit this file!  It is auto-generated by frameworks/rs/api/generate.sh.
18
19/*
20 * rs_time.rsh: Time Functions and Types
21 *
22 * The functions below can be used to tell the current clock time and the current
23 * system up time.  It is not recommended to call these functions inside of a kernel.
24 */
25
26#ifndef RENDERSCRIPT_RS_TIME_RSH
27#define RENDERSCRIPT_RS_TIME_RSH
28
29/*
30 * rs_time_t: Seconds since January 1, 1970
31 *
32 * Calendar time interpreted as seconds elapsed since the Epoch (00:00:00 on
33 * January 1, 1970, Coordinated Universal Time (UTC)).
34 */
35#ifndef __LP64__
36typedef int rs_time_t;
37#endif
38
39#ifdef __LP64__
40typedef long rs_time_t;
41#endif
42
43/*
44 * rs_tm: Date and time structure
45 *
46 * Data structure for broken-down time components.
47 */
48typedef struct {
49    int tm_sec; // Seconds after the minute. This ranges from 0 to 59, but possibly up to 60 for leap seconds.
50    int tm_min; // Minutes after the hour. This ranges from 0 to 59.
51    int tm_hour; // Hours past midnight. This ranges from 0 to 23.
52    int tm_mday; // Day of the month. This ranges from 1 to 31.
53    int tm_mon; // Months since January. This ranges from 0 to 11.
54    int tm_year; // Years since 1900.
55    int tm_wday; // Days since Sunday. This ranges from 0 to 6.
56    int tm_yday; // Days since January 1. This ranges from 0 to 365.
57    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.
58} rs_tm;
59
60/*
61 * rsGetDt: Elapsed time since last call
62 *
63 * Returns the time in seconds since this function was last called in this script.
64 *
65 * Returns: Time in seconds.
66 */
67extern float __attribute__((overloadable))
68    rsGetDt(void);
69
70/*
71 * rsLocaltime: Convert to local time
72 *
73 * Converts the time specified by timer into a rs_tm structure that provides year, month,
74 * hour, etc.  This value is stored at *local.
75 *
76 * This functions returns the same pointer that is passed as first argument.  If the
77 * local parameter is NULL, this function does nothing and returns NULL.
78 *
79 * Parameters:
80 *   local: Pointer to time structure where the local time will be stored.
81 *   timer: Input time as a number of seconds since January 1, 1970.
82 *
83 * Returns: Pointer to the output local time, i.e. the same value as the parameter local.
84 */
85extern rs_tm* __attribute__((overloadable))
86    rsLocaltime(rs_tm* local, const rs_time_t* timer);
87
88/*
89 * rsTime: Seconds since January 1, 1970
90 *
91 * Returns the number of seconds since the Epoch (00:00:00 UTC, January 1, 1970).
92 *
93 * If timer is non-NULL, the result is also stored in the memory pointed to by
94 * this variable.
95 *
96 * Parameters:
97 *   timer: Location to also store the returned calendar time.
98 *
99 * Returns: Seconds since the Epoch, -1 if there's an error.
100 */
101extern rs_time_t __attribute__((overloadable))
102    rsTime(rs_time_t* timer);
103
104/*
105 * rsUptimeMillis: System uptime in milliseconds
106 *
107 * Returns the current system clock (uptime) in milliseconds.
108 *
109 * Returns: Uptime in milliseconds.
110 */
111extern int64_t __attribute__((overloadable))
112    rsUptimeMillis(void);
113
114/*
115 * rsUptimeNanos: System uptime in nanoseconds
116 *
117 * Returns the current system clock (uptime) in nanoseconds.
118 *
119 * The granularity of the values return by this call may be much larger than a nanosecond.
120 *
121 * Returns: Uptime in nanoseconds.
122 */
123extern int64_t __attribute__((overloadable))
124    rsUptimeNanos(void);
125
126#endif // RENDERSCRIPT_RS_TIME_RSH
127