: gettime ( -- s m h ) trigger @ "flags" getpropstr "-g" instr if 2871643 else 0 then systime + ctime dup ":" rinstr 2 + strcut pop dup ":" instr 3 - strcut swap pop ":" explode pop rot atoi rot atoi rot atoi ; : do_gametime ( -- s s ) systime 2871643 + ctime dup " " instr 1 - strcut 1 strcut swap pop dup " " instr 1 - strcut pop dup "jan" stringcmp not if pop "Januri" then dup "feb" stringcmp not if pop "Febri" then dup "mar" stringcmp not if pop "Martch" then dup "apr" stringcmp not if pop "Abril" then dup "jun" stringcmp not if pop "Jun" then dup "jul" stringcmp not if pop "July" then dup "aug" stringcmp not if pop "Angst" then dup "sep" stringcmp not if pop "Septeeber" then dup "oct" stringcmp not if pop "Octovre" then dup "nov" stringcmp not if pop "Novre" then dup "dec" stringcmp not if pop "Decevre" then swap dup "mon" stringcmp not if pop "Monde" then dup "tue" stringcmp not if pop "Tuesde" then dup "wed" stringcmp not if pop "Wednesde" then dup "thu" stringcmp not if pop "Thursde" then dup "fri" stringcmp not if pop "Fride" then dup "sat" stringcmp not if pop "Saturde" then dup "sun" stringcmp not if pop "Sunde" then swap ; : do_time ( -- s ) systime ctime dup " " instr 1 - strcut 1 strcut swap pop dup " " instr 1 - strcut pop dup "jan" stringcmp not if pop "January" then dup "feb" stringcmp not if pop "February" then dup "mar" stringcmp not if pop "March" then dup "apr" stringcmp not if pop "April" then dup "jun" stringcmp not if pop "June" then dup "jul" stringcmp not if pop "July" then dup "aug" stringcmp not if pop "August" then dup "sep" stringcmp not if pop "September" then dup "oct" stringcmp not if pop "October" then dup "nov" stringcmp not if pop "November" then dup "dec" stringcmp not if pop "December" then swap dup "mon" stringcmp not if pop "Monday" then dup "tue" stringcmp not if pop "Tuesday" then dup "wed" stringcmp not if pop "Wednesday" then dup "thu" stringcmp not if pop "Thursday" then dup "fri" stringcmp not if pop "Friday" then dup "sat" stringcmp not if pop "Saturday" then dup "sun" stringcmp not if pop "Sunday" then swap ; : main ( s -- ) pop trigger @ "flags" getpropstr tolower "-g" 2 strncmp not if do_gametime else do_time then "It is " gettime rot pop "" 3 pick 30 > if pop over 60 swap - intostr " minutes before " strcat swap 1 + swap 3 pick 1 = if "minute" "minutes" subst then then 3 pick dup 0 > swap 31 < and if pop over intostr " minutes after " strcat 3 pick 1 = if "minute" "minutes" subst then then rot pop swap dup 23 > if 24 - then "" over 12 = if pop "Noon on " then over not if pop "Midnight on " then over dup 12 = not swap and if pop dup dup 12 > if pop 12 - dup "PM" else "AM" then swap intostr " o'clock %m on " strcat swap "%m" subst then swap pop strcat strcat rot strcat ", " strcat swap strcat " " strcat trigger @ "flags" getpropstr "-g" instr if systime 2871643 + else systime then ctime dup ":" instr 4 - strcut swap dup strlen 2 - strcut swap pop atoi intostr "" over dup strlen 1 - strcut swap pop dup "1" stringcmp not if "st" rot pop swap then dup "2" stringcmp not if "nd" rot pop swap then dup "3" stringcmp not if "rd" rot pop swap then pop dup not if pop "th" then strcat swap dup " " rinstr strcut swap pop ", " swap atoi trigger @ "flags" getpropstr "-g" instr if 1623 - then intostr strcat "." strcat strcat strcat me @ swap notify ;