Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 12th, 2012  |  syntax: None  |  size: 1.09 KB  |  hits: 6  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // LIST OF TIMEZONES:   http://markitup.com/WebServices/TimeZones.asmx/GetTimeZoneNames
  2. // WEB SERVICE ADDRESS: http://markitup.com/WebServices/TimeZones.asmx/CurrentDateTime?timeZoneName=[TIMEZONE]
  3.  
  4. class (time,socket) {
  5.         constructor() {
  6.                 #echo trying to connect
  7.                 $$->$connect("markitup.com",80)
  8.                
  9.         }
  10.  
  11.         connectFailedEvent() {
  12.                 #echo connection failed
  13.                 echo "Couldn't connect to markitup.com"
  14.         }
  15.  
  16.         connectEvent() {
  17.                 #echo /WebServices/TimeZones.asmx/CurrentDateTime?timeZoneName=%Timezone HTTP/1.1\r\n
  18.                 $$->$write("GET /WebServices/TimeZones.asmx/CurrentDateTime?timeZoneName=%Timezone HTTP/1.1\r\n")
  19.                 $$->$write(Host: www.markitup.com\r\n)
  20.                 $$->$write(Connection: close\r\n\r\n)
  21.         }
  22.  
  23.         dataAvailableEvent() {
  24.                 #echo reading data
  25.                 %Data = %Data + $$->$read($0)
  26.         }
  27.  
  28.         disconnectEvent() {
  29.                 //echo disconnected from server
  30.                 //echo %Data
  31.                 %splitData = $str.split("\n", %Data)
  32.                 $$->%date = $str.replace($str.lefttofirst($str.rightfromfirst($str.grep("<datetime", %splitData, r, 0), ">"), "<"), " ", "T")
  33.                 msg $$->%chan $$->%name"'s local time is currently" $$->%date"."
  34.         }
  35. }