-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTimeFuncs.cpp
More file actions
44 lines (37 loc) · 1.03 KB
/
TimeFuncs.cpp
File metadata and controls
44 lines (37 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "BowieLogger.h"
void BowieLogger::digitalClockDisplay() {
// from the TimeTeensy3 example code
// most likely by Paul S
// digital clock display of the time
Serial.print(hour());
printDigits(minute());
printDigits(second());
Serial.print(" ");
Serial.print(day());
Serial.print(" ");
Serial.print(month());
Serial.print(" ");
Serial.print(year());
Serial.println();
}
void BowieLogger::initTime() {
// from the TimeTeensy3 example code
// most likely by Paul S
// set the Time library to use Teensy 3.0's RTC to keep time
setSyncProvider(getTeensy3Time);
if (timeStatus()!= timeSet) {
Serial.println("Unable to sync with the RTC");
} else {
Serial.println("RTC has set the system time");
}
}
time_t BowieLogger::getTeensy3Time() {
return Teensy3Clock.get();
}
void BowieLogger::printDigits(int digits) {
// utility function for digital clock display: prints preceding colon and leading 0
Serial.print(":");
if(digits < 10)
Serial.print('0');
Serial.print(digits);
}