Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Jerryscript
提交
b514e0b6
T
Third Party Jerryscript
项目概览
OpenHarmony
/
Third Party Jerryscript
9 个月 前同步成功
通知
5
Star
19
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Jerryscript
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
b514e0b6
编写于
5月 08, 2021
作者:
O
openharmony_ci
提交者:
Gitee
5月 08, 2021
浏览文件
操作
浏览文件
下载
差异文件
!12 【輕量級 PR】:update get_local_time and time_zone for Jupiter
Merge pull request !12 from Gavin1012/N/A
上级
42dcd861
bdafd58e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
8 addition
and
15 deletion
+8
-15
jerry-port/default/default-date.c
jerry-port/default/default-date.c
+8
-15
未找到文件。
jerry-port/default/default-date.c
浏览文件 @
b514e0b6
...
...
@@ -33,17 +33,12 @@
#ifdef JERRY_FOR_IAR_CONFIG
#define _BSD_SOURCE
#include "time.h"
/* the "sys/time.h" should be put ahead of "time.h" so that the right implementation for gettimeofday can be found. */
#include "sys/time.h"
#include "time.h"
#include "config-gt.h"
#include "config-jupiter.h"
#define GET_SIGN_BIT(x) ((x) >> sizeof (x) * 8 - 1)
#define GET_TIMEZONE_HOUR(timeZone) (((timeZone) >> 8) & 0x7F)
#define GET_TIMEZONE_MIN(timeZone) ((timeZone) & 0xFF)
#define HOUR_TO_MIN 60
#define MIN_TO_SEC 60
#endif
#endif
/* JERRY_FOR_IAR_CONFIG */
#ifdef _WIN32
/* https://support.microsoft.com/en-us/help/167296/how-to-convert-a-unix-time-t-to-a-win32-filetime-or-systemtime */
...
...
@@ -78,9 +73,7 @@ double jerry_port_get_local_time_zone_adjustment (double unix_ms, /**< ms since
}
return
((
double
)
tm
.
tm_gmtoff
)
*
1000
;
#else
/* !HAVE_TM_GMTOFF */
#ifdef JERRY_FOR_IAR_CONFIG
// We don't use unix_ms and is_utc, since timezone cannot be computed
// as a function of given time.
#ifdef JERRY_IAR_JUPITER
struct
tm
tm
;
time_t
now
=
(
time_t
)
(
unix_ms
/
1000
);
localtime_r
(
&
now
,
&
tm
);
...
...
@@ -90,7 +83,7 @@ double jerry_port_get_local_time_zone_adjustment (double unix_ms, /**< ms since
localtime_r
(
&
now
,
&
tm
);
}
return
((
double
)
tm
.
tm_gmtoff
)
*
1000
;
#else
#else
/* !JERRY_IAR_JUPITER */
(
void
)
unix_ms
;
(
void
)
is_utc
;
#ifdef _WIN32
...
...
@@ -127,14 +120,14 @@ double jerry_port_get_local_time_zone_adjustment (double unix_ms, /**< ms since
*/
double
jerry_port_get_current_time
(
void
)
{
#if defined (__GNUC__) || defined (JERRY_
FOR_IAR_CONFIG
)
struct
timeval
tv
;
#if defined (__GNUC__) || defined (JERRY_
IAR_JUPITER
)
struct
timeval
tv
=
{
0
}
;
if
(
gettimeofday
(
&
tv
,
NULL
)
==
0
)
{
return
((
double
)
tv
.
tv_sec
)
*
1000
.
0
+
((
double
)
tv
.
tv_usec
)
/
1000
.
0
;
}
#endif
/* __GNUC__ || JERRY_
FOR_IAR_CONFIG
*/
#endif
/* __GNUC__ || JERRY_
IAR_JUPITER
*/
#ifdef _WIN32
time_t
ltime
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录