Output elapsed time for data logging (for yourself)

Stopwatch

This is a memo for myself.

It's like a stopwatch for logging data such as temperature. Normally, the time is recorded, but this time it is a test program created to record the elapsed time.

python


import datetime
import time


def main():
    s_time = datetime.datetime.now()
    while True:
        time.sleep(2)
        now_time = datetime.datetime.now()
        time_delta = now_time - s_time
        print(time_delta)

if __name__ == '__main__':
    main()

The execution result is as follows.

sh


pi@raspberrypi:~/Works/temp_logger/test $ python stopwatch.py
0:00:02.002138
0:00:04.004865
0:00:06.007525
0:00:08.009917
0:00:10.012274
0:00:12.014638
0:00:14.016988

Used in Raspberry Pi. Usage is omitted.

Recommended Posts

Output elapsed time for data logging (for yourself)
Time series data anomaly detection for beginners
Anchoco for yourself
Prepare sample data for text mining by yourself
Output python execution time
[Understand in the shortest time] Python basics for data analysis
Introducing yourself at Qiita for the first time (test post)