UtopiaTime functions for mIRC v6.3By: cerberus
Last Modified: Dec 28 10:31am (r3)

after you have loaded this script, it is recomended that you sync the time with swirve using
/uto.timesync
this command will NOT change your system time, but store the second error.
after this you need to enter the start date of the age
do this by typing
/uto.agestart
this will show a dialog, simply paste the current utopia time and hit ok
good luck and have fun!
/uto.timesync
this command will NOT change your system time, but store the second error.
after this you need to enter the start date of the age
do this by typing
/uto.agestart
this will show a dialog, simply paste the current utopia time and hit ok
good luck and have fun!

;;;; utopia time bundle
alias uto.timesync sockopen uto.timesync u1.swirve.com 80
on *:sockopen:uto.timesync: {
sockwrite -n $sockname GET / HTTP/1.0
sockwrite -n $sockname Host: $sock($sockname).ip
sockwrite -n $sockname Connection: Close
sockwrite -n $sockname
}
on *:sockread:uto.timesync: {
var %tmp,%re /Date: (.*)/
sockread %tmp
if ($regex(%tmp,%re)) {
set %uto.timesync $iif($calc(($gmt - $ctime($regml(1))) % 3600) <= 1800,$ifmatch,$calc($ifmatch - 3600))
sockclose uto.timesync
}
}
alias uto.ctime return $calc($ctime - %uto.timesync)
alias uto.time {
var %utbase $int($calc($gmt + ($1 * 3600) - $ctime(%uto.timestart) - %uto.timesync))
var %uty $int($calc(%utbase / 604800))
var %utm $int($calc((%utbase % 604800) / 86400))
var %utm $asctime( $calc(790127600 + ( %utm * 2592000) ),mmmm)
var %utd $int($calc(((%utbase % 604800) % 86400) / 3600))
var %utd $ord($calc(%utd + 1))
return %utm %utd $+ , YR $+ %uty
}
alias uto.parsetime {
var %re /(\w+) (\d+)w+?. YR(\d+)/si
if ($regex($1-,%re)) {
var %months January February March April May June July
var %uty $regml(3)
var %uty $calc(%uty * 604800)
var %utm $regml(1)
var %utm $calc(($findtok(%months,%utm,1,32) - 1) * 86400)
var %utd $regml(2)
var %utd $calc(%utd * 3600)
var %sec $calc(%uty + %utm + %utd)
return %sec
}
else return $false
}
alias uto.agestart {
var %uto.date $?="Please enter current utopia date"
var %sync $uto.parsetime(%uto.date)
if (%sync) set %uto.timestart $asctime($calc($uto.ctime - %sync),dd/mm/yy hh:00:00)
else echo -tmga -invalid date-
}
on *:text:!time*:*:notice $nick [ $uto.time ] $asctime($calc(3600 - $uto.ctime % 3600),nn:ss)
|

Comments