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 * @file
19 * DRM 1.0 Reference Port: linux implementation of drm_time.c.
20 */
21
22#include <objmng/drm_time.h>
23#include <unistd.h>
24
25/* See drm_time.h */
26uint32_t DRM_time_getElapsedSecondsFrom1970(void)
27{
28    return time(NULL);
29}
30
31/* See drm_time.h */
32void DRM_time_sleep(uint32_t ms)
33{
34    usleep(ms * 1000);
35}
36
37/* See drm_time.h */
38void DRM_time_getSysTime(T_DB_TIME_SysTime *time_ptr)
39{
40    time_t t;
41    struct tm *tm_t;
42
43    time(&t);
44    tm_t = gmtime(&t);
45
46    time_ptr->year = tm_t->tm_year + 1900;
47    time_ptr->month = tm_t->tm_mon + 1;
48    time_ptr->day = tm_t->tm_mday;
49    time_ptr->hour = tm_t->tm_hour;
50    time_ptr->min = tm_t->tm_min;
51    time_ptr->sec = tm_t->tm_sec;
52}
53