help-gplusplus
[Top][All Lists]
Advanced

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

Re: C++ get time in milliseconds


From: Thomas
Subject: Re: C++ get time in milliseconds
Date: Thu, 01 Jun 2006 23:01:09 -0700
User-agent: Mozilla Thunderbird 1.0.7-1.1.fc3 (X11/20050929)

I think this is a question for a linux programming list.
The g++ list pertains to the g++ compiler and its strengths and flaws.

You could probably do what you want with something like

  timespec ts;
  //get the time this was received
  if (0!= clock_gettime(CLOCK_REALTIME, &ts))
  {
    //error unable to get clocktime
    error=strerror(errno);
    cerr<<"Error getting time Reason: "<<error<<endl;
    exit(1);
  }

  cout<<"timeStampSecs="<<ts.tv_sec
      <<timeStampNanoSecs='"<<ts.tv_nsec <<endl;



nirkheys@gmail.com wrote:
Hi All,

I am working on a RedHat Linux with GCC 3.0.I want to retrieve time in
milliseconds.
<ctime> provides seconds precision only.
hope to get help

Thanks & Regards
Saurabh






reply via email to

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