[416] in Zephyr_Comments
[The Danceaholic: A code fragment for .zwgc.desc]
daemon@ATHENA.MIT.EDU (John T Kohl)
Thu Jan 11 08:40:25 1990
Date: Thu, 11 Jan 90 08:40:03 -0500
From: John T Kohl <jtkohl@ATHENA.MIT.EDU>
To: zephyr-comments@ATHENA.MIT.EDU
------- Forwarded Message
From: wizard@ATHENA.MIT.EDU
To: jtkohl@ATHENA.MIT.EDU
Subject: A code fragment for .zwgc.desc
Date: Wed, 10 Jan 90 21:17:28 EST
Hi!
This code is meant to change the format of the time to civilian format.
-------------------------------
# look in the direct /mit/zephyr/examples for more example fragments
# like this
#
# This file describes how to convert the standard 24-hour military time to
# the 12-hour civilian time (e.g. 21:00:00 --> 9:00:00 PM)
#
# This fragment goes immediately before the 'case $class / match "MESSAGE"'
# commands near the beginning of the standard .zwgc.desc file
set hr = lany($time, "00")
# This command takes the "raw" hour (on the 24-hour scale) and leaves the
# variable $time with the minutes and seconds.
case $hr
match "00"
set hour = "12"
set part = "AM"
match "12"
set part = "PM"
match "13"
set hour = "1"
set part = "PM"
match "14"
set hour = "2"
set part = "PM"
match "15"
set hour = "3"
set part = "PM"
match "16"
set hour = "4"
set part = "PM"
match "17"
set hour = "5"
set part = "PM"
match "18"
set hour = "6"
set part = "PM"
match "19"
set hour = "7"
set part = "PM"
match "20"
set hour = "8"
set part = "PM"
match "21"
set hour = "9"
set part = "PM"
match "22"
set hour = "10"
set part = "PM"
match "23"
set hour = "11"
set part = "PM"
default
set part = "AM"
endcase
# This case statement changes the 24-hour scale to the appropriate 12-hour
# scale, and also returns "AM" or "PM" as appropriate.
set time = rbreak("0", $hour)+$time+" "+$part
# This runs it all together. The rbreak function is used to strip off any
# trailing "0" at the front of the $hour variable.
------- End Forwarded Message