Hmm, I don't understand what's happening, though why not use the time generated via Twitch's API?
This is the code for my !uptime that I use.
on *:text:!uptime*:#: {
if (%flood_Uptime) && ($nick != $mid(#,2)) { halt }
set -u30 %flood_Uptime On
if ($0 == 2) {
var %status = $startTime($2)
var %displayName = $displayName($2)
var %game = $followGame($2)
if (%status == $null) {
msg # /me - %displayName is currently offline.
}
else {
msg # /me - %displayName $+ 's stream has been online with " $+ %game $+ " for $duration($calc($ctime - (%status - $timezone))) $+ !
}
}
if ($0 == 1) {
var %status = $startTime($mid(#,2))
var %displayName = $displayName($mid(#,2))
if (%status == $null) {
msg # /me - %displayName is offline.
}
else {
msg # /me - We've been live for $duration($calc($ctime - (%status - $timezone))) $+ !
}
}
}
alias startTime {
var %j = streamUptime
JSONOpen -ud %j https://api.twitch.tv/kraken/streams/ $+ $1 $+ ?= $+ $ticks
var %uptime = $ctime($replace($json(%j,stream,created_at),T,$chr(32),Z,))
return %uptime
}
This uses SReject's JSON Parser. Found
here.
Returns are usually like this
<@fonic_artes> !uptime
> If Offline
<@bot> /me - Fonic_Artes is offline.
> If Online
<@bot> /me - We've been live for 8hrs 27mins 15secs!
<@fonic_artes> !uptime artesbot
> If Offline
<@bot> /me - Artesbot is currently offline.
> If Online
<@bot> /me - Artesbot's stream has been online with "Final Fantasy IV" for 1day 4hrs 13mins 59secs!