Skip to content

Commit 8cd6b07

Browse files
committed
time fix
1 parent 1fd7c72 commit 8cd6b07

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

Pulse_Oximeter_Logger/pulse_oximeter_logger.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
set_time = False
4545
if set_time: # change to True if you want to write the time!
4646
# year, mon, date, hour, min, sec, wday, yday, isdst
47-
t = time.struct_time((2020, 4, 21, 16, 36, 0, 2, -1, -1))
47+
t = time.struct_time((2020, 4, 21, 18, 13, 0, 2, -1, -1))
4848
# you must set year, mon, date, hour, min, sec and weekday
4949
# yearday not supported, isdst can be set but we don't use it at this time
5050
print("Setting time to:", t) # uncomment for debugging
@@ -55,7 +55,6 @@
5555
ble = adafruit_ble.BLERadio() # pylint: disable=no-member
5656

5757
pulse_ox_connection = None
58-
initial_time = time.monotonic()
5958

6059
while True:
6160
t = rtc.datetime
@@ -113,12 +112,7 @@
113112

114113
try: # logging to SD card
115114
with open("/sd_card/log.txt", "a") as sdc:
116-
current_time = time.monotonic()
117-
time_stamp = current_time - initial_time
118-
print(
119-
"Seconds since current data log started:",
120-
int(time_stamp),
121-
)
115+
t = rtc.datetime
122116
sdc.write(
123117
"{} {}/{}/{} {}:{}:{} ".format(
124118
days[t.tm_wday],
@@ -127,12 +121,12 @@
127121
t.tm_year,
128122
t.tm_hour,
129123
t.tm_min,
130-
t.tm_sec,
124+
t.tm_sec
131125
)
132126
)
133127
sdc.write(
134-
"{}, {}, {}, {:.2f}\n".format(
135-
int(time_stamp), spo2, pulse_rate, pleth
128+
"{}, {}, {:.2f}\n".format(
129+
spo2, pulse_rate, pleth
136130
)
137131
)
138132

0 commit comments

Comments
 (0)