#!/usr/bin/perl # $Id: localtimed,v 1.2 2005/12/24 10:12:22 jfranken Exp $ # # (c) 11/2005 by Johannes Franken # # Outputs localtime in time-protocol (RFC868)-format # # Installation: # 1.) copy localtimed to /usrl/local/bin/ # 2.) chmod 755 /usr/local/bin/localtimed # # If you have inetd running: (e.g. on Debian, Solaris) # 3.) Change the "time"-line in your /etc/inetd.conf to: # time stream tcp nowait nobody /usr/local/bin/localtimed # 4.) Have inetd reload its configfile # pkill -1 inetd # # If you have xinetd running (e.g. SuSE, Red Hat, Fedora, Mandrake) # 3.) edit /etc/xinetd.d/time: # service time # { # socket_type = stream # protocol = tcp # wait = no # user = nobody # server = /usr/local/bin/localtimed # id = time-stream # } # 4.) have xinetd reload its configfiles: # pkill -1 xinetd # # # To Test: # TZ=UTC rdate -p localhost # should print the localtime (respecting your timezone/summertime) # print pack("N",time+`date +%z`*36+2208988800);