Lafontaine
2007-Apr-24 13:03 UTC
[dtrace-discuss] timestamp %Y with milliseconds and nanoseconds
Hi, how can I printf the date with milliseconds and nanoseconds? printf("%Y",walltimestamp); give me "2007 Apr 19 15:49:41" and I want to know the milliseconds and ns. Thank you if you have the answer! Fabien This message posted from opensolaris.org
Chip Bennett
2007-Apr-24 13:18 UTC
[dtrace-discuss] timestamp %Y with milliseconds and nanoseconds
Hi Fabien, The walltimestamp variable is just an integer: printf ("%d ns\n", walltimestamp); printf ("%d ms\n", walltimestamp / 1000000); Chip Lafontaine wrote:> Hi, > how can I printf the date with milliseconds and nanoseconds? > printf("%Y",walltimestamp); give me "2007 Apr 19 15:49:41" and I want to know the milliseconds and ns. > Thank you if you have the answer! > > Fabien > > > This message posted from opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org >
Chip Bennett
2007-Apr-25 17:24 UTC
[dtrace-discuss] timestamp %Y with milliseconds and nanoseconds
It appears I misunderstood this question. What Fabien was really asking was for a way to display walltimestamp using the %Y format, but with ns or ms trailing behind. Perhaps something list this: wt = walltimestamp; printf ("%Y:%dns", wt, wt % 1000000000); printf ("%Y:%dms", wt, (wt % 1000000000) / 1000000); I''m using a variable for walltimestamp in printf to make sure that each piece of the printed time comes from the same value. Chip Chip Bennett wrote:> Hi Fabien, > > The walltimestamp variable is just an integer: > > printf ("%d ns\n", walltimestamp); > printf ("%d ms\n", walltimestamp / 1000000); > > Chip > > Lafontaine wrote: >> Hi, >> how can I printf the date with milliseconds and nanoseconds? >> printf("%Y",walltimestamp); give me "2007 Apr 19 15:49:41" and I want >> to know the milliseconds and ns. >> Thank you if you have the answer! >> >> Fabien >> >> >> This message posted from opensolaris.org >> _______________________________________________ >> dtrace-discuss mailing list >> dtrace-discuss at opensolaris.org >> > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org