linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Masters <jonmasters@gmail.com>
To: Suciu Flavius <suciuflavius@tiscali.de>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: Unix Time
Date: Sun, 26 Sep 2004 23:57:11 +0100	[thread overview]
Message-ID: <35fb2e590409261557361c5dea@mail.gmail.com> (raw)
In-Reply-To: <cj6vk0$c3i$1@sea.gmane.org>

On Sun, 26 Sep 2004 20:01:04 -0700, Suciu Flavius
<suciuflavius@tiscali.de> wrote:

>   struct timeval start,stop;
>   int elapsed;
> 
>   gettimeofday(&start,NULL);
> 
>   computeWhatIWant();
> 
>   gettimeofday(&stop,NULL);
> 
> elapsed=(stop.tv_sec-start.tv_sec)*1000000+(stop.tv_usec-start.tv_usec);
> printf("sprintf:  elapsed=%5d miliseconds\n",elapsed);
 
...or you could use the POSIX difftime function if you don't mind
having a double returned.

Jon.

  reply	other threads:[~2004-09-26 22:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-26 14:02 Unix Time Ankit Jain
2004-09-27  3:01 ` Suciu Flavius
2004-09-26 22:57   ` Jon Masters [this message]
2004-09-27  5:10     ` Ankit Jain
2004-09-27 10:59       ` szonyi calin
2004-09-27 11:57         ` Jon Masters
2004-09-27 21:33           ` Sumit Narayan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=35fb2e590409261557361c5dea@mail.gmail.com \
    --to=jonmasters@gmail.com \
    --cc=jonathan@jonmasters.org \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=suciuflavius@tiscali.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).