Jason Sams | 044e2ee | 2011-08-08 16:52:30 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2011 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 | /** @file rs_time.rsh |
| 18 | * \brief Time routines |
| 19 | * |
| 20 | * |
| 21 | */ |
| 22 | |
Stephen Hines | ca3f09c | 2011-01-07 15:11:30 -0800 | [diff] [blame] | 23 | #ifndef __RS_TIME_RSH__ |
| 24 | #define __RS_TIME_RSH__ |
| 25 | |
| 26 | typedef int rs_time_t; |
| 27 | |
| 28 | typedef struct { |
| 29 | int tm_sec; |
| 30 | int tm_min; |
| 31 | int tm_hour; |
| 32 | int tm_mday; |
| 33 | int tm_mon; |
| 34 | int tm_year; |
| 35 | int tm_wday; |
| 36 | int tm_yday; |
| 37 | int tm_isdst; |
| 38 | } rs_tm; |
| 39 | |
| 40 | extern rs_time_t __attribute__((overloadable)) |
| 41 | rsTime(rs_time_t *timer); |
| 42 | |
| 43 | extern rs_tm * __attribute__((overloadable)) |
| 44 | rsLocaltime(rs_tm *local, const rs_time_t *timer); |
| 45 | |
| 46 | // Return the current system clock in milliseconds |
| 47 | extern int64_t __attribute__((overloadable)) |
| 48 | rsUptimeMillis(void); |
| 49 | |
| 50 | // Return the current system clock in nanoseconds |
| 51 | extern int64_t __attribute__((overloadable)) |
| 52 | rsUptimeNanos(void); |
| 53 | |
| 54 | // Return the time in seconds since function was last called in this script. |
| 55 | extern float __attribute__((overloadable)) |
| 56 | rsGetDt(void); |
| 57 | |
| 58 | #endif |