1

When I do: date system call on freeBSD, does it internally use gettimeofday ?

Another que: how do I know where the code of "date" command sitting on the system?

Thanks.

hari
  • 9,439
  • 27
  • 76
  • 110

1 Answers1

2

You can find the source for date in the online SVN repository browser.

The date command calls time() to get the current time.

Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
  • Thanks Greg. Any commandline way of doing the same? Finding where source is sitting? – hari Jan 11 '11 at 08:14
  • Thanks Greg, I am trying to see who can call gettimeofday? Any command you know which uses it? – hari Jan 11 '11 at 08:24
  • 1
    @hari: On my system (with the FreeBSD source installed) the source file is at `/usr/src/bin/date/date.c`. I don't know of a command which specifically calls `gettimeofday()`, but the easiest way to get one is to write one and compile it. – Greg Hewgill Jan 11 '11 at 08:49