Nemo #6520(2008/06/16 09:03 GMT) [ PostScript ] Rating0/0=0.00
PostScript では realtime オペレータで現在時刻を取り出せるのですが、なんと原点(0)がいつを指すかは未定義です。 そのため、別途パラメータで補ってやる必要があります。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
%!PS /ZeroNum { % integer (string) ZeroNum (string') dup dup length dup string 5 -1 roll exch cvs dup length 3 -1 roll sub neg exch putinterval } bind def /GetClock { % % Input % Offset1(YYYYMMDD in int) % Offset2(offset for realtime clock to 00:00:00.000 in millisec) % Output % (String) (YYYYMMDD000000.000) dup 0 8 getinterval 4 -1 roll exch ZeroNum pop exch realtime 86400000 mod add 86400000 add 86400000 mod dup 1000 mod 2 index 15 3 getinterval ZeroNum pop 1000 idiv dup 60 mod 2 index 12 2 getinterval ZeroNum pop 60 idiv dup 60 mod 2 index 10 2 getinterval ZeroNum pop 60 idiv 1 index 8 2 getinterval ZeroNum pop } bind def % ========= Test Code ============ 20080616 32940000 GetClock ==
Rating0/0=0.00-0+
[ reply ]
Nemo
#6520()
[
PostScript
]
Rating0/0=0.00
PostScript では realtime オペレータで現在時刻を取り出せるのですが、なんと原点(0)がいつを指すかは未定義です。 そのため、別途パラメータで補ってやる必要があります。
%!PS /ZeroNum { % integer (string) ZeroNum (string') dup dup length dup string 5 -1 roll exch cvs dup length 3 -1 roll sub neg exch putinterval } bind def /GetClock { % % Input % Offset1(YYYYMMDD in int) % Offset2(offset for realtime clock to 00:00:00.000 in millisec) % Output % (String) (YYYYMMDD000000.000) dup 0 8 getinterval 4 -1 roll exch ZeroNum pop exch realtime 86400000 mod add 86400000 add 86400000 mod dup 1000 mod 2 index 15 3 getinterval ZeroNum pop 1000 idiv dup 60 mod 2 index 12 2 getinterval ZeroNum pop 60 idiv dup 60 mod 2 index 10 2 getinterval ZeroNum pop 60 idiv 1 index 8 2 getinterval ZeroNum pop } bind def % ========= Test Code ============ 20080616 32940000 GetClock ==Rating0/0=0.00-0+
[ reply ]