Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
alios-things
AliOS-Things
提交
f4cd40ef
A
AliOS-Things
项目概览
alios-things
/
AliOS-Things
10 个月 前同步成功
通知
62
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
AliOS-Things
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
f4cd40ef
编写于
5月 20, 2022
作者:
Y
yinsuo
提交者:
skylarCai
5月 24, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support sntp interface. #1657
上级
65d4becc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
35 addition
and
3 deletion
+35
-3
components/py_engine/modules/sntp/aos/modsntp.c
components/py_engine/modules/sntp/aos/modsntp.c
+1
-2
components/py_engine/modules/sntp/esp32/modsntp.c
components/py_engine/modules/sntp/esp32/modsntp.c
+1
-1
haas_lib_bundles/python/docs/haas_extended_api/sntp.md
haas_lib_bundles/python/docs/haas_extended_api/sntp.md
+33
-0
未找到文件。
components/py_engine/modules/sntp/aos/modsntp.c
浏览文件 @
f4cd40ef
...
...
@@ -33,8 +33,7 @@ STATIC mp_obj_t mp_sntp_settime(size_t n_args, const mp_obj_t *args)
tz
.
tz_minuteswest
=
-
480
;
tz
.
tz_dsttime
=
0
;
sntp_set_timezone
(
&
tz
);
return
MP_OBJ_NEW_SMALL_INT
(
0
);
return
mp_const_none
;
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
mp_sntp_settime_obj
,
0
,
2
,
mp_sntp_settime
);
...
...
components/py_engine/modules/sntp/esp32/modsntp.c
浏览文件 @
f4cd40ef
...
...
@@ -76,7 +76,7 @@ STATIC mp_obj_t mp_sntp_settime(size_t n_args, const mp_obj_t *args)
strftime
(
strftime_buf
,
sizeof
(
strftime_buf
),
"%c"
,
&
timeinfo
);
ESP_LOGI
(
TAG
,
"The current date/time in China is: %s"
,
strftime_buf
);
return
MP_OBJ_NEW_SMALL_INT
(
0
)
;
return
mp_const_none
;
}
STATIC
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN
(
mp_sntp_settime_obj
,
0
,
2
,
mp_sntp_settime
);
...
...
haas_lib_bundles/python/docs/haas_extended_api/sntp.md
0 → 100644
浏览文件 @
f4cd40ef
# sntp - 获取并设定ntp时间
-
模块功能:
获取并设定ntp时间
## setTime - 设置时间
-
函数功能:
指定时区(默认“CST-8”)或者授时服务器(默认“cn.pool.ntp.org”),获取并设定ntp时间。
-
函数原型:
> sntp.setTime([zone], [ntp_server_addr])
-
参数说明:
| 参数 | 类型 | 必选参数? | 说明 |
| --- | --- | --- | --- |
| zone | string | 否 | 时区信息 |
| ntp_server_addr | string | 否 | 授时服务器地址 |
-
返回值:
无
-
示例:
```
python
import
sntp
sntp
.
setTime
(
"CST-8"
,
"cn.pool.ntp.org"
)
```
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录