• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 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 
18 /**
19  * @file
20  * Time Porting Layer
21  *
22  * Basic support functions that are needed by time.
23  *
24  * <!-- #interface list begin -->
25  * \section drm_time Interface
26  * - DRM_time_getElapsedSecondsFrom1970()
27  * - DRM_time_sleep()
28  * - DRM_time_getSysTime()
29  * <!-- #interface list end -->
30  */
31 
32 #ifndef __DRM_TIME_H__
33 #define __DRM_TIME_H__
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 #include <time.h>
40 #include <drm_common_types.h>
41 
42 /** the time format */
43 typedef struct __db_system_time_
44 {
45     uint16_t year;
46     uint16_t month;
47     uint16_t day;
48     uint16_t hour;
49     uint16_t min;
50     uint16_t sec;
51 } T_DB_TIME_SysTime;
52 
53 /**
54  * Get the system time.it's up to UTC
55  * \return Return the time in elapsed seconds.
56  */
57 uint32_t DRM_time_getElapsedSecondsFrom1970(void);
58 
59 /**
60  * Suspend the execution of the current thread for a specified interval
61  * \param ms suspended time by millisecond
62  */
63 void DRM_time_sleep(uint32_t ms);
64 
65 /**
66  * function: get current system time
67  * \param  time_ptr[OUT]  the system time got
68  * \attention
69  *    time_ptr must not be NULL
70  */
71 void DRM_time_getSysTime(T_DB_TIME_SysTime *time_ptr);
72 
73 #ifdef __cplusplus
74 }
75 #endif
76 
77 #endif /* __DRM_TIME_H__ */
78