time 736 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. .TH TIME 2
  2. .SH NAME
  3. time, nsec \- time in seconds and nanoseconds since epoch
  4. .SH SYNOPSIS
  5. .B #include <u.h>
  6. .br
  7. .B #include <libc.h>
  8. .PP
  9. .nf
  10. .B
  11. long time(long *tp)
  12. .PP
  13. .B
  14. vlong nsec(void)
  15. .SH DESCRIPTION
  16. Both
  17. .I time
  18. and
  19. .I nsec
  20. return the time since the epoch 00:00:00 GMT, Jan. 1, 1970.
  21. The return value of the former is in seconds and the latter in nanoseconds.
  22. For
  23. .IR time ,
  24. if
  25. .I tp
  26. is not zero then
  27. .BI * tp
  28. is also set to the answer.
  29. .PP
  30. These functions work by reading
  31. .BR /dev/bintime ,
  32. opening that file when they are first called.
  33. .SH SOURCE
  34. .B /sys/src/libc/9sys/time.c
  35. .br
  36. .B /sys/src/libc/9sys/nsec.c
  37. .SH SEE ALSO
  38. .IR cons (3)
  39. .SH DIAGNOSTICS
  40. Sets
  41. .IR errstr .
  42. .SH BUGS
  43. These routines maintain a static file descriptor.