Plan 9 from Bell Labs’s /usr/web/sources/contrib/fgb/root/sys/src/cmd/4th/lib/ansfacil.4th

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


\ 4tH library - ANS FACILITY - Copyright 2003,2007 J.L. Bezemer
\ You can redistribute this file and/or modify it under
\ the terms of the GNU General Public License

[UNDEFINED] time&date [IF]
VARIABLE da VARIABLE mo VARIABLE yr

2440588 1721119 [negate] [+] +constant adjust

: TIME&DATE time 86400 /mod >r 3600 /mod >r 60 /mod r> r> adjust
  2* 2* 1- dup 146097 / dup yr ! 146097 * - 2/ 2/ 2* 2* 3 +
  1461 /mod SWAP 4 + 4 / 5 * 3 - 153 /MOD mo ! 5 + 5 / da ! yr @ 100
  * + yr ! mo @ 10 < IF 3 mo +! ELSE -9 mo +! 1 yr +! THEN da @ mo
  @ yr @ ;

\ a very crude implementation of MS
: MS 1000 / 1+ >r time begin time over - r@ > until r> drop drop ;

[DEFINED] 4TH# [IF]
hide adjust
hide da
hide mo
hide yr
[THEN]
[THEN]

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.