Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- To get the date use $asctime(), for example:
- $asctime($ConvertTwitchTime(<date-time field here>), mmm dd yyyy HH:nn:ss)
- To get the seconds-since use subtract from $ctime
- $calc($ctime - $ConvertTwitchTime(<date-time field here>))
- To get the time-since in something a bit more readable, use $duration
- $duration($calc($ctime - $ConvertTwitchTime(<date-time field here>)))
- */
- ;; coverts a twitch date-time field into a UTC epoch integer
- alias ConvertTwitchTime {
- if ($regex($1-, /^(\d\d(?:\d\d)?)-(\d\d)-(\d\d)T(\d\d)\:(\d\d)\:(\d\d)(?:(?:Z$)|(?:([+-])(\d\d)\:(\d+)))?$/i)) {
- var %m = $Gettok(January February March April May June July August September October November December, $regml(2), 32), %d = $ord($base($regml(3),10,10)), %o = +0, %t
- if ($regml(0) > 6) %o = $regml(7) $+ $calc($regml(8) * 3600 + $regml(9))
- %t = $calc($ctime(%m %d $regml(1) $regml(4) $+ : $+ $regml(5) $+ : $+ $regml(6)) - %o)
- if ($asctime(zz) !== 0 && $regex($v1, /^([+-])(\d\d)(\d+)$/)) {
- %o = $regml(1) $+ $calc($regml(2) * 3600 + $regml(3))
- %t = $calc(%t + %o )
- }
- return %t
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement