How to calculate the time spent between two functions?

To avoid putting too much strain on my shared server, I would like to check that my application is only checked for an update every 12 hours at least. Once a first search has been carried out, I must store the date and time in my Preferences file (plist) in the form of a string (String) then each time the application is launched or via the “Search an update” menu, i check that more than 12 hours have passed, in which case I connect again.
Do you have any suggestions on the string format and how to do this?
Thanks

String format should be SQLDateTime format as it is easily readable.

You can then use

If Datetime.now.TotalSeconds - theDate.TotalSeconds > 3600*12 then //greater than 12 hours

1 Like

I’d use SQLDateTIme, as there are convenient functions for converting back to DateTime where you can then do comparisons.

1 Like