groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] Is there a good way to get time/date?


From: Werner LEMBERG
Subject: Re: [Groff] Is there a good way to get time/date?
Date: Wed, 26 Apr 2000 10:22:50 +0000 (GMT)

> In order to get the time/date I've done:
>       
> 
> .sy echo Printed `date` >current.date
> .so current.date
> .sy rm current.date
> .sy stat \n(.F | fgrep Change >change.time
> .so change.time
> .sy rm change.time
> 
> And it produced:
>             Printed Tue Apr 25 13:09:26 EDT 2000
>       Change: Tue Apr 25 13:08:33 2000(00000.00:00:53)
> 
> Is there a better way?  There could be.
> (this is very useful when doing documents)

AFAIK, there is no better way.  Here is the (similar) example given in
groff.texinfo:

  .sy perl -e 'printf ".nr H %d\\n.nr M %d\\n.nr S %d\\n",\
              (localtime(time))[2,1,0]' > /tmp/x\n[$$]
  .so /tmp/x\n[$$]
  .sy rm /tmp/x\n[$$]
  \nH:\nM:\nS

To use the sy request we need the -U switch which is not optimal.

Maybe we shall add registers to provide the current time also in
gtroff?


    Werner


reply via email to

[Prev in Thread] Current Thread [Next in Thread]