ropg / ezTime

ezTime — pronounced "Easy Time" — is a very easy to use Arduino time and date library that provides NTP network time lookups, extensive timezone support, formatted time and date strings, user events, millisecond precision and more.
MIT License
327 stars 92 forks source link

Comparing DateTime #80

Closed Rich-Hopkins closed 4 years ago

Rich-Hopkins commented 4 years ago

Is there a way that you would recommend for comparing datetimes? For example, I want to know if a timestamp received from an API is more than 2 hours prior to current time. Both times would be in UTC so timezone and DST conversion is not necessary.

ropg commented 4 years ago

Is there a way that you would recommend for comparing datetimes? For example, I want to know if a timestamp received from an API is more than 2 hours prior to current time. Both times would be in UTC so timezone and DST conversion is not necessary.

Eh... Simply get the times in seconds since epoch and see if they're more or less than 7200 seconds apart?

Rop

Rich-Hopkins commented 4 years ago

Umm... Yeah. Thanks.