0

I know how to get time of the current day in seconds

import time
seconds=time.time() % 86400

However the result is valid for UTC. Is there elegant way to do that for local time? I am aware I could get that somehow from local time struct_time, but it will be rather complicated procedure. Is there any elegant way to do that?

Pygmalion
  • 785
  • 2
  • 8
  • 24

1 Answers1

1

It's not complicated to get it from struct_time.

t = time.localtime()
secs = 3600 * t.tm_hour + 60 * t.tm_min + t.tm_sec
Barmar
  • 741,623
  • 53
  • 500
  • 612