Skip to content

Commit da3f4a6

Browse files
Use a cheaper variable
1 parent 39b02be commit da3f4a6

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/dimmerTask.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "dimmerTask.hpp"
22

3-
static unsigned long long msSinceMidnight()
3+
static unsigned int msSinceMidnight()
44
{
55
// Time should already be synced through SNTP!
66
struct timeval now;
@@ -9,14 +9,13 @@ static unsigned long long msSinceMidnight()
99
struct tm currentTime;
1010
localtime_r(&now.tv_sec, &currentTime);
1111

12-
int secondsSinceMidnight =
12+
unsigned int secondsSinceMidnight =
1313
currentTime.tm_hour * 3600 +
1414
currentTime.tm_min * 60 +
1515
currentTime.tm_sec;
1616

17-
unsigned long long millisecondsSinceMidnight =
18-
(unsigned long long)secondsSinceMidnight * 1000ULL +
19-
now.tv_usec / 1000;
17+
unsigned int millisecondsSinceMidnight =
18+
secondsSinceMidnight * 1000U + now.tv_usec / 1000;
2019

2120
return millisecondsSinceMidnight;
2221
}

0 commit comments

Comments
 (0)