Skip to content

jdhxyy/ntp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ntp

介绍

基于Golang编写,在海萤物联网提供校时服务。

本机地址是:

0x41000005

服务

服务号 服务
1 读取时间1
2 读取时间2.返回的是结构体

读取时间服务1

  • 请求:空或者带符号的1个字节。

当请求为空时,则默认为读取的是北京时间(时区8)。

也可以带1个字节表示时区号。这个字节是有符号的int8。

小技巧,可以使用0x100减去正值即负值。比如8对应的无符号数是0x100-8=248。

  • 应答:当前时间的字符串

当前时间字符串的格式:2006-01-02 15:04:05 -0700 MST

读取时间服务2.返回的是结构体

  • 请求:格式与读取时间服务1一致

  • 应答:

struct {
    // 时区
    uint8 TimeZone
    uint16 Year
    uint8 Month
    uint8 Day
    uint8 Hour
    uint8 Minute
    uint8 Second
    // 星期
    uint8 Weekday
}

About

NTP server in tziot for Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages