mlco2 / codecarbon

Track emissions from Compute and recommend ways to reduce their impact on the environment.
https://mlco2.github.io/codecarbon
MIT License
1k stars 157 forks source link

Update emissions_tracker.py to fix issue #549 #589

Closed LeahChercham closed 1 week ago

LeahChercham commented 1 week ago

Update emissions_tracker.py to fix issue https://github.com/mlco2/codecarbon/issues/549 Divide by zero in start_task() by replacing time.time() by time.perf_counter()

Replaced all time.time() by time.perf_counter() in file emissions_tracker.py.

perf_counter gets the current time with higher precision.

(I had to recreate this pull request as I deleted my repo by mistake: https://github.com/mlco2/codecarbon/pull/570)