Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 1 | /* |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 2 | * Copyright (C) 2015 The Android Open Source Project |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 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 | |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 17 | // Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh. |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 18 | |
| 19 | /* |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 20 | * rs_time.rsh: Time Functions and Types |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 21 | * |
Pirama Arumuga Nainar | db74586 | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 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. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 24 | */ |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 25 | |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 26 | #ifndef RENDERSCRIPT_RS_TIME_RSH |
| 27 | #define RENDERSCRIPT_RS_TIME_RSH |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 28 | |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 29 | /* |
| 30 | * rs_time_t: Seconds since January 1, 1970 |
| 31 | * |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 32 | * Calendar time interpreted as seconds elapsed since the Epoch (00:00:00 on |
| 33 | * January 1, 1970, Coordinated Universal Time (UTC)). |
| 34 | */ |
Tim Murray | f9c8de5 | 2014-09-10 18:36:01 -0700 | [diff] [blame] | 35 | #ifndef __LP64__ |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 36 | typedef int rs_time_t; |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 37 | #endif |
| 38 | |
| 39 | #ifdef __LP64__ |
Tim Murray | f9c8de5 | 2014-09-10 18:36:01 -0700 | [diff] [blame] | 40 | typedef long rs_time_t; |
| 41 | #endif |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 42 | |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 43 | /* |
| 44 | * rs_tm: Date and time structure |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 45 | * |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 46 | * Data structure for broken-down time components. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 47 | */ |
| 48 | typedef struct { |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 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. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 58 | } rs_tm; |
| 59 | |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 60 | /* |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 61 | * rsGetDt: Elapsed time since last call |
| 62 | * |
Pirama Arumuga Nainar | db74586 | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 63 | * Returns the time in seconds since this function was last called in this script. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 64 | * |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 65 | * Returns: Time in seconds. |
Ying Wang | b335bb0 | 2011-11-29 10:23:55 -0800 | [diff] [blame] | 66 | */ |
| 67 | extern float __attribute__((overloadable)) |
| 68 | rsGetDt(void); |
| 69 | |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 70 | /* |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 71 | * rsLocaltime: Convert to local time |
| 72 | * |
Pirama Arumuga Nainar | db74586 | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 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. |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 75 | * |
Pirama Arumuga Nainar | db74586 | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 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. |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 78 | * |
| 79 | * Parameters: |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 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. |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 82 | * |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 83 | * Returns: Pointer to the output local time, i.e. the same value as the parameter local. |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 84 | */ |
| 85 | extern rs_tm* __attribute__((overloadable)) |
| 86 | rsLocaltime(rs_tm* local, const rs_time_t* timer); |
| 87 | |
| 88 | /* |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 89 | * rsTime: Seconds since January 1, 1970 |
| 90 | * |
Pirama Arumuga Nainar | db74586 | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 91 | * Returns the number of seconds since the Epoch (00:00:00 UTC, January 1, 1970). |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 92 | * |
| 93 | * If timer is non-NULL, the result is also stored in the memory pointed to by |
| 94 | * this variable. |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 95 | * |
| 96 | * Parameters: |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 97 | * timer: Location to also store the returned calendar time. |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 98 | * |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 99 | * Returns: Seconds since the Epoch, -1 if there's an error. |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 100 | */ |
| 101 | extern rs_time_t __attribute__((overloadable)) |
| 102 | rsTime(rs_time_t* timer); |
| 103 | |
| 104 | /* |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 105 | * rsUptimeMillis: System uptime in milliseconds |
| 106 | * |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 107 | * Returns the current system clock (uptime) in milliseconds. |
| 108 | * |
| 109 | * Returns: Uptime in milliseconds. |
| 110 | */ |
| 111 | extern int64_t __attribute__((overloadable)) |
| 112 | rsUptimeMillis(void); |
| 113 | |
| 114 | /* |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 115 | * rsUptimeNanos: System uptime in nanoseconds |
| 116 | * |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 117 | * Returns the current system clock (uptime) in nanoseconds. |
| 118 | * |
Pirama Arumuga Nainar | db74586 | 2015-05-11 14:34:37 -0700 | [diff] [blame] | 119 | * The granularity of the values return by this call may be much larger than a nanosecond. |
Stephen Hines | 3f86823 | 2015-04-10 09:22:19 -0700 | [diff] [blame] | 120 | * |
Stephen Hines | b4d9c8b | 2015-03-30 16:04:04 -0700 | [diff] [blame] | 121 | * Returns: Uptime in nanoseconds. |
| 122 | */ |
| 123 | extern int64_t __attribute__((overloadable)) |
| 124 | rsUptimeNanos(void); |
| 125 | |
| 126 | #endif // RENDERSCRIPT_RS_TIME_RSH |