Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
my_xihale
Time
提交
4fef0834
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,发现更多精彩内容 >>
未验证
提交
4fef0834
编写于
1月 20, 2018
作者:
P
Paul Stoffregen
提交者:
GitHub
1月 20, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #88 from zharovdv/master
Update TimeLib.h
上级
6dd00e28
7251f894
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
11 addition
and
11 deletion
+11
-11
TimeLib.h
TimeLib.h
+11
-11
未找到文件。
TimeLib.h
浏览文件 @
4fef0834
...
...
@@ -73,19 +73,19 @@ typedef time_t(*getExternalTime)();
#define SECS_YR_2000 ((time_t)(946684800UL)) // the time at the start of y2k
/* Useful Macros for getting elapsed time */
#define numberOfSeconds(_time_) (
_time_
% SECS_PER_MIN)
#define numberOfMinutes(_time_) ((
_time_
/ SECS_PER_MIN) % SECS_PER_MIN)
#define numberOfHours(_time_) ((
_time_
% SECS_PER_DAY) / SECS_PER_HOUR)
#define dayOfWeek(_time_)
((( _time_
/ SECS_PER_DAY + 4) % DAYS_PER_WEEK)+1) // 1 = Sunday
#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
#define numberOfSeconds(_time_) (
(_time_)
% SECS_PER_MIN)
#define numberOfMinutes(_time_) ((
(_time_)
/ SECS_PER_MIN) % SECS_PER_MIN)
#define numberOfHours(_time_) ((
(_time_)
% SECS_PER_DAY) / SECS_PER_HOUR)
#define dayOfWeek(_time_)
((((_time_)
/ SECS_PER_DAY + 4) % DAYS_PER_WEEK)+1) // 1 = Sunday
#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 settting 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
#define previousSunday(_time_)
(_time_
- elapsedSecsThisWeek(_time_)) // time at the start of the week for the given time
#define nextSunday(_time_) (
previousSunday(_time_)+SECS_PER_WEEK) // time at the end of the week for the given time
#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
#define previousSunday(_time_)
((_time_)
- elapsedSecsThisWeek(_time_)) // time at the start of the week for the given time
#define nextSunday(_time_) (previousSunday(_time_)+SECS_PER_WEEK) // time at the end of the week for the given time
/* Useful Macros for converting elapsed time to a time_t */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录