Plan 9 from Bell Labs’s /usr/web/sources/contrib/fgb/rc/ctime

Copyright © 2009 Alcatel-Lucent.
Distributed under the Lucent Public License version 1.02.
Download the Plan 9 distribution.


#!/bin/rc

rfork ne

uflag=()
while(! ~ $#* 0 && ~ $1 -*) {
	switch ($1) {
	case -u
		uflag=1
		shift
	case -*
		echo Usage: `{basename $0}  [-u] [when] >[1=2]
		exit usage	
	}
	shift
}

now=`{date $flag $1 | 
	sed '
		s/  ([0-9])/  0\1/
		s/Jan/01/
		s/Feb/02/
		s/Mar/03/
		s/Apr/04/
		s/May/05/
		s/Jun/06/
		s/Jul/07/
		s/Aug/08/
		s/Sep/09/
		s/Oct/10/
		s/Nov/11/
		s/Dec/12/'}

if(~ $uflag 1)
	echo $now(6)^-^$now(2)^-^$now(3)^T^$now(4)^Z
if not
	echo $now(6)^$now(2)^$now(3)

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2009 Alcatel-Lucent. All Rights Reserved.
Comments to webmaster@plan9.bell-labs.com.