linux-l: linux zeit abfrage

gunni at mathematik.hu-berlin.de gunni at mathematik.hu-berlin.de
Sa Jan 27 17:28:56 CET 2001



On Sat, 27 Jan 2001, Vlad Hayrapetyan wrote:

> Hallo!
> 
> Wesst jemand wie ich aktuelle Zeit mit Genauigket bis millsec. abfragen
> kann? (in C++) . In standart time ist nur die struct tm,  die mir Zeit bis
> sec. liefert
> 
> Vlad
> 
man 2 time:

...
SEE ALSO  
   ... gettimeofday(2)
...

Also:

man gettimeofday

Bei mir funktioniert:


#include <sys/time.h>
#include <unistd.h>

struct timeval mytv;

int
main(void) {
  gettimeofday(&mytv, NULL);
  printf("Sekunden: %ld\t Mikrosekunden: %ld\n", mytv.tv_sec,
mytv.tv_usec);
}




Mehr Informationen über die Mailingliste linux-l