Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
my_xihale
Time
提交
3d5114d0
T
Time
项目概览
my_xihale
/
Time
与 Fork 源项目一致
从无法访问的项目Fork
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Time
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
3d5114d0
编写于
2月 11, 2020
作者:
P
pieterbl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed typos in TimeLib.h and Time.cpp
Change-Id: Ia05c370e8f09b75dddf11cf2aa8b5de4c21bd45d
上级
7acd2442
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
4 addition
and
4 deletion
+4
-4
Time.cpp
Time.cpp
+3
-3
TimeLib.h
TimeLib.h
+1
-1
未找到文件。
Time.cpp
浏览文件 @
3d5114d0
...
...
@@ -141,9 +141,9 @@ int year(time_t t) { // the year for the given time
/*============================================================================*/
/* functions to convert to and from system time */
/* These are for interfacing with time ser
iv
ces and are not normally needed in a sketch */
/* These are for interfacing with time ser
vi
ces and are not normally needed in a sketch */
// leap year calulator expects year argument as years offset from 1970
// leap year cal
c
ulator expects year argument as years offset from 1970
#define LEAP_YEAR(Y) ( ((1970+(Y))>0) && !((1970+(Y))%4) && ( ((1970+(Y))%100) || !((1970+(Y))%400) ) )
static
const
uint8_t
monthDays
[]
=
{
31
,
28
,
31
,
30
,
31
,
30
,
31
,
31
,
30
,
31
,
30
,
31
};
// API starts months from 1, this array starts from 0
...
...
@@ -213,7 +213,7 @@ time_t makeTime(const tmElements_t &tm){
seconds
=
tm
.
Year
*
(
SECS_PER_DAY
*
365
);
for
(
i
=
0
;
i
<
tm
.
Year
;
i
++
)
{
if
(
LEAP_YEAR
(
i
))
{
seconds
+=
SECS_PER_DAY
;
// add extra days for leap years
seconds
+=
SECS_PER_DAY
;
// add extra days for leap years
}
}
...
...
TimeLib.h
浏览文件 @
3d5114d0
...
...
@@ -80,7 +80,7 @@ typedef time_t(*getExternalTime)();
#define elapsedDays(_time_) ((_time_) / SECS_PER_DAY) // this is number of days since Jan 1 1970
#define elapsedSecsToday(_time_) ((_time_) % SECS_PER_DAY) // the number of seconds since last midnight
// The following macros are used in calculating alarms and assume the clock is set to a date later than Jan 1 1971
// Always set the correct time before sett
t
ing alarms
// Always set the correct time before setting alarms
#define previousMidnight(_time_) (((_time_) / SECS_PER_DAY) * SECS_PER_DAY) // time at the start of the given day
#define nextMidnight(_time_) (previousMidnight(_time_) + SECS_PER_DAY) // time at the end of the given day
#define elapsedSecsThisWeek(_time_) (elapsedSecsToday(_time_) + ((dayOfWeek(_time_)-1) * SECS_PER_DAY)) // note that week starts on day 1
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录