You should be able to use the Int() function on a timestamp to return the UTC seconds. Another way to get UTC seconds from a timestamp is to write the output to an attribute of type Int32.
On a related note, if you write an integer value with Analytics to an attribute that is of type DateTime, it will convert the integer as UTC seconds to a date.
Thanks for that - I tried the following and it worked fine (output was mapped to an attribute of type Int32).
Int(ParseTime("*")) - Int(PrevEvent('Input Tag', ParseTime("*")))
I also tried this, and it worked too.
Int(ParseTime("*") - PrevEvent('Input Tag', ParseTime("*")))
However, this didn't work
ParseTime("*") - PrevEvent('Input Tag', ParseTime("*"))
Which is a little odd. If Int() allows me to convert a Timespan to seconds, why can't I just write it to an Int32 attribute?
Note that you don't need to use ParseTime everywhere to get a timestamp. Simply '*' or 't' (Note: in single quotes) will do.
OK. Thanks Mike. I guess I must have been influenced by this extract from the help for ParseTime (my bolding)
There is no difference between ParseTime("14-Nov-92") and the time expression '14-Nov-92', except that the ParseTime call takes more time. This is because the time expression (enclosed in single quotes) is evaluated at compile time, not run time.
Though why I thought that '*' would be evaluated at compile time I don't know - perhaps it was late.
Having tested it it does, of course, work.
Having done some more testing, I am somewhat surprised that Timestamp('Input Tag') doesn't return the snapshot timestamp. It just seems to return the current time.
ParseTime is there, I believe, for cases where you might be reading a time from an attribute/tag that is a string.
Yea that's a gotcha of Timestamp. The value for 'Input Tag' has been interpolated for the scheduled time, so it's timestamp is effectively '*', but this is not what most people expect, I think. The AF 2.7 version of Analysis will include some new functions that make it easier to figure out how long since an attribute/tag has received a new value.