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