rejetto forum

Software => HFS ~ HTTP File Server => HTML & templates => Topic started by: Foggy on March 01, 2009, 11:37:16 AM

Title: Unix time
Post by: Foggy on March 01, 2009, 11:37:16 AM
I am playing around with a template idea and I am after a way to check two time values to see whether or not something has timed out.

The only way I can think of doing it is with Unix(seconds since 1970) time and taking the original value from the new value and comparing the difference to a predefined timeout value.

Is it possible to have unix time added to the time macro? or perhaps a template symbol for it?

Also after some research into the time macro I have come across the symbol %now% but cant find any explanation. What does it do/what is it for?
Title: Re: Unix time
Post by: rejetto on March 01, 2009, 02:36:40 PM
%now% uses the delphi time format: it's functionally equivalent to the unix time, just numerically different.
but you can use it the same way, to calculate the difference between 2 moments.

while the unix time is integer and 1 is a second, the delphi time is real(with point) and 1 is a day.


{.set|x|%now%.}

do something

{.calc|(%now% - {.^x.})/(24*60*60).} seconds passed

you can even make a user-macro yourself to convert between the 2 formats.
http://www.delphifaq.com/faq/f91.shtml
Title: Re: Unix time
Post by: Foggy on March 02, 2009, 05:12:49 AM
Thankyou Rejetto.

Thats exactly what I wanted to know.
Title: Re: Unix time
Post by: Fysack on March 03, 2009, 11:14:27 PM
 :-* :-* :-* what can i say? The world is my oyster!