Revert "lists: Add list literal doc example."
[factor.git] / extra / time-server / time-server.factor
blob1b2f14650aecd368484ed826a528c36dc1657fe3
1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors calendar calendar.format command-line io
4 io.encodings.ascii io.servers kernel math.parser namespaces
5 sequences threads ;
6 IN: time-server
8 : handle-time-client ( -- )
9     now timestamp>rfc822 print ;
11 : <time-server> ( port -- threaded-server )
12     ascii <threaded-server>
13         "time-server" >>name
14         swap >>insecure
15         [ handle-time-client ] >>handler ;
17 : time-server-main ( -- )
18     command-line get [ 1234 ] [ first string>number ] if-empty
19     <time-server> start-server wait-for-server ;
21 MAIN: time-server-main