Commit 19ade7b3 authored by Kristian Tan's avatar Kristian Tan

Remove microseconds from elapsed time

parent 41467160
......@@ -73,15 +73,14 @@ def toggle_pin(change_pin):
message += " off."
if pins[change_pin]['on_time'] is not None:
start_time = pins[change_pin]['on_time']
elapsed = datetime.now() - start_time
elapsed_formatted = datetime.strftime(elapsed, '%H-%M-%S')
elapsed = str(datetime.now() - start_time)
# Format the time
start_date_string = datetime.strftime(start_time, '%Y-%m-%d')
# Create datetime object from formatted time
start_date = datetime.strptime(start_date_string, '%Y-%m-%d')
entry = DailyUsage(date=start_date, on_time=elapsed_formatted)
entry = DailyUsage(date=start_date, on_time=elapsed)
db.session.add(entry)
db.session.commit()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment