Glayson0 / Nova-bot

Um bot do Telegram para passar informações da Unicamp como horário dos onibus e do bandeco
3 stars 0 forks source link

Verify avaible users using dates as int #25

Open Sergio-Daniel-Pires opened 3 months ago

Sergio-Daniel-Pires commented 3 months ago

Reasons to convert dates to int:

  1. Directly comparison
  2. Can use data structures int-compared-based
  3. Less space and more efficient

How I do this?

  1. Convert time.now() to elapsed milliseconds, like: 00:00:01 = 1, 00:01:01 = 61, 00:02:54 = 174.
  2. Convert bus times to int based too.
  3. For an give list, only compares if now are less than X, if are, break the list on X.

https://stackoverflow.com/questions/36695186/how-to-compare-unix-data-and-time Search about unix timestamp.