summaryrefslogtreecommitdiff
path: root/tvapi/libtv/tv/CTvTime.cpp (plain)
blob: 10b9f7acaac05f709ec738a6cb393db69427e0dd
1//
2//
3// amlogic 2013
4//
5// @ Project : tv
6// @ File Name : CTvChannel.h
7// @ Date : 2013-11
8// @ Author :
9//
10#define LOG_TAG "CTvTime"
11
12#include "CTvTime.h"
13
14/**
15 *设定当前时间
16 *@param time 当前时间(毫秒单位)
17 */
18long CTvTime::getSysUTCTime()
19{
20 //struct tm tm;
21 //time_t t;
22 //int64_t r = mktime_tz(&(tm), NULL);
23 //time_t t = time(NULL);
24 //LOGD("---------utc t = %ld time t=%ld", r, t);
25 return 0;
26}
27
28void CTvTime::setTime(long t)
29{
30 //long utcMS;
31 //time(&utcMS);
32 //nsecs_t ns = systemTime(CLOCK_REALTIME);
33 //nsecs_t tm = ns2s(ns);
34 //unsigned long ticks = times(NULL);
35 //long tm = ticks/mHZ;
36 struct sysinfo s_info;
37 int error;
38 error = sysinfo(&s_info);
39
40 mDiff = t - s_info.uptime;
41 LOGD("--- mDiff=%ld", mDiff);
42}
43
44/**
45 *取得当前时间
46 *@return 返回当前时间
47 */
48long CTvTime::getTime()
49{
50 //long utcMS;
51 //time(&utcMS);
52 //nsecs_t ns = systemTime(CLOCK_REALTIME);
53 //nsecs_t sec = ns2s(ns);
54
55 //unsigned long ticks = times(NULL);
56 //long sec = ticks/mHZ;
57 struct sysinfo s_info;
58 int error;
59 error = sysinfo(&s_info);
60
61
62 LOGD("--- mDiff=%ld, sec=%ld", mDiff, s_info.uptime);
63 return s_info.uptime + mDiff;
64}
65