blob: 05987f83726ac4fcfce158b8686d998a2c33f740 [file] [log] [blame]
Ying Wangb335bb02011-11-29 10:23:55 -08001/*
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -07002 * Copyright (C) 2015 The Android Open Source Project
Ying Wangb335bb02011-11-29 10:23:55 -08003 *
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
Stephen Hines3f868232015-04-10 09:22:19 -070017// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -070018
19/*
Stephen Hines3f868232015-04-10 09:22:19 -070020 * rs_time.rsh: Time Functions and Types
Ying Wangb335bb02011-11-29 10:23:55 -080021 *
Pirama Arumuga Nainardb745862015-05-11 14:34:37 -070022 * 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.
Ying Wangb335bb02011-11-29 10:23:55 -080024 */
Stephen Hines3f868232015-04-10 09:22:19 -070025
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -070026#ifndef RENDERSCRIPT_RS_TIME_RSH
27#define RENDERSCRIPT_RS_TIME_RSH
Ying Wangb335bb02011-11-29 10:23:55 -080028
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -070029/*
30 * rs_time_t: Seconds since January 1, 1970
31 *
Ying Wangb335bb02011-11-29 10:23:55 -080032 * Calendar time interpreted as seconds elapsed since the Epoch (00:00:00 on
33 * January 1, 1970, Coordinated Universal Time (UTC)).
34 */
Tim Murrayf9c8de52014-09-10 18:36:01 -070035#ifndef __LP64__
Ying Wangb335bb02011-11-29 10:23:55 -080036typedef int rs_time_t;
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -070037#endif
38
39#ifdef __LP64__
Tim Murrayf9c8de52014-09-10 18:36:01 -070040typedef long rs_time_t;
41#endif
Ying Wangb335bb02011-11-29 10:23:55 -080042
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -070043/*
44 * rs_tm: Date and time structure
Ying Wangb335bb02011-11-29 10:23:55 -080045 *
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -070046 * Data structure for broken-down time components.
Ying Wangb335bb02011-11-29 10:23:55 -080047 */
48typedef struct {
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -070049 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.
Ying Wangb335bb02011-11-29 10:23:55 -080058} rs_tm;
59
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -070060/*
Stephen Hines3f868232015-04-10 09:22:19 -070061 * rsGetDt: Elapsed time since last call
62 *
Pirama Arumuga Nainardb745862015-05-11 14:34:37 -070063 * Returns the time in seconds since this function was last called in this script.
Ying Wangb335bb02011-11-29 10:23:55 -080064 *
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -070065 * Returns: Time in seconds.
Ying Wangb335bb02011-11-29 10:23:55 -080066 */
67extern float __attribute__((overloadable))
68 rsGetDt(void);
69
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -070070/*
Stephen Hines3f868232015-04-10 09:22:19 -070071 * rsLocaltime: Convert to local time
72 *
Pirama Arumuga Nainardb745862015-05-11 14:34:37 -070073 * Converts the time specified by timer into a rs_tm structure that provides year, month,
74 * hour, etc. This value is stored at *local.
Stephen Hines3f868232015-04-10 09:22:19 -070075 *
Pirama Arumuga Nainardb745862015-05-11 14:34:37 -070076 * 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.
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -070078 *
79 * Parameters:
Stephen Hines3f868232015-04-10 09:22:19 -070080 * 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.
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -070082 *
Stephen Hines3f868232015-04-10 09:22:19 -070083 * Returns: Pointer to the output local time, i.e. the same value as the parameter local.
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -070084 */
85extern rs_tm* __attribute__((overloadable))
86 rsLocaltime(rs_tm* local, const rs_time_t* timer);
87
88/*
Stephen Hines3f868232015-04-10 09:22:19 -070089 * rsTime: Seconds since January 1, 1970
90 *
Pirama Arumuga Nainardb745862015-05-11 14:34:37 -070091 * Returns the number of seconds since the Epoch (00:00:00 UTC, January 1, 1970).
Stephen Hines3f868232015-04-10 09:22:19 -070092 *
93 * If timer is non-NULL, the result is also stored in the memory pointed to by
94 * this variable.
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -070095 *
96 * Parameters:
Stephen Hines3f868232015-04-10 09:22:19 -070097 * timer: Location to also store the returned calendar time.
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -070098 *
Stephen Hines3f868232015-04-10 09:22:19 -070099 * Returns: Seconds since the Epoch, -1 if there's an error.
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -0700100 */
101extern rs_time_t __attribute__((overloadable))
102 rsTime(rs_time_t* timer);
103
104/*
Stephen Hines3f868232015-04-10 09:22:19 -0700105 * rsUptimeMillis: System uptime in milliseconds
106 *
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -0700107 * 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/*
Stephen Hines3f868232015-04-10 09:22:19 -0700115 * rsUptimeNanos: System uptime in nanoseconds
116 *
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -0700117 * Returns the current system clock (uptime) in nanoseconds.
118 *
Pirama Arumuga Nainardb745862015-05-11 14:34:37 -0700119 * The granularity of the values return by this call may be much larger than a nanosecond.
Stephen Hines3f868232015-04-10 09:22:19 -0700120 *
Stephen Hinesb4d9c8b2015-03-30 16:04:04 -0700121 * Returns: Uptime in nanoseconds.
122 */
123extern int64_t __attribute__((overloadable))
124 rsUptimeNanos(void);
125
126#endif // RENDERSCRIPT_RS_TIME_RSH