rs_time.rsh revision 7c07854a959eb70ff9623202b2ca064407a1cc68
1/* 2 * Copyright (C) 2015 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/gen_runtime. 18 19/* 20 * rs_time.rsh: RenderScript time routines 21 * 22 * This file contains RenderScript functions relating to time and date manipulation. 23 */ 24#ifndef RENDERSCRIPT_RS_TIME_RSH 25#define RENDERSCRIPT_RS_TIME_RSH 26 27/* 28 * rs_time_t: Seconds since January 1, 1970 29 * 30 * Calendar time interpreted as seconds elapsed since the Epoch (00:00:00 on 31 * January 1, 1970, Coordinated Universal Time (UTC)). 32 */ 33#ifndef __LP64__ 34typedef int rs_time_t; 35#endif 36 37#ifdef __LP64__ 38typedef long rs_time_t; 39#endif 40 41/* 42 * rs_tm: Date and time structure 43 * 44 * Data structure for broken-down time components. 45 */ 46typedef struct { 47 int tm_sec; // Seconds after the minute. This ranges from 0 to 59, but possibly up to 60 for leap seconds. 48 int tm_min; // Minutes after the hour. This ranges from 0 to 59. 49 int tm_hour; // Hours past midnight. This ranges from 0 to 23. 50 int tm_mday; // Day of the month. This ranges from 1 to 31. 51 int tm_mon; // Months since January. This ranges from 0 to 11. 52 int tm_year; // Years since 1900. 53 int tm_wday; // Days since Sunday. This ranges from 0 to 6. 54 int tm_yday; // Days since January 1. This ranges from 0 to 365. 55 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. 56} rs_tm; 57 58/* 59 * Returns the time in seconds since this function was last called in this 60 * script. 61 * 62 * Returns: Time in seconds. 63 */ 64extern float __attribute__((overloadable)) 65 rsGetDt(void); 66 67/* 68 * Converts the time specified by p timer into broken-down time and stores it 69 * in p local. This function also returns a pointer to p local. If p local 70 * is NULL, this function does nothing and returns NULL. 71 * 72 * Parameters: 73 * local Broken-down time. 74 * timer Input time as calendar time. 75 * 76 * Returns: Pointer to broken-down time (same as input p local). 77 */ 78extern rs_tm* __attribute__((overloadable)) 79 rsLocaltime(rs_tm* local, const rs_time_t* timer); 80 81/* 82 * Returns the number of seconds since the Epoch (00:00:00 UTC, January 1, 83 * 1970). If p timer is non-NULL, the result is also stored in the memory 84 * pointed to by this variable. If an error occurs, a value of -1 is returned. 85 * 86 * Parameters: 87 * timer Location to also store the returned calendar time. 88 * 89 * Returns: Seconds since the Epoch. 90 */ 91extern rs_time_t __attribute__((overloadable)) 92 rsTime(rs_time_t* timer); 93 94/* 95 * Returns the current system clock (uptime) in milliseconds. 96 * 97 * Returns: Uptime in milliseconds. 98 */ 99extern int64_t __attribute__((overloadable)) 100 rsUptimeMillis(void); 101 102/* 103 * Returns the current system clock (uptime) in nanoseconds. 104 * 105 * Returns: Uptime in nanoseconds. 106 */ 107extern int64_t __attribute__((overloadable)) 108 rsUptimeNanos(void); 109 110#endif // RENDERSCRIPT_RS_TIME_RSH 111