lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 09 Feb 2012 01:25:33 -0800
From:	Dmitry Antipov <dmitry.antipov@...aro.org>
To:	Richard Cochran <richardcochran@...il.com>
CC:	Thomas Gleixner <tglx@...utronix.de>,
	John Stultz <john.stultz@...aro.org>,
	linux-kernel@...r.kernel.org, linaro-dev@...ts.linaro.org
Subject: Re: clock_getres() and real resolution

On 02/08/2012 09:12 PM, Richard Cochran wrote:

> I think "resolution" does not mean tick duration, but rather the finest timer unit.

#include <stdio.h>
#include <time.h>

int main (int argc, char *argv[])
{
   int i;
   struct timespec rs, ts[10];

   clock_getres (CLOCK_REALTIME, &rs);
   printf ("res: %lus %luns\n", rs.tv_sec, rs.tv_nsec);

   for (i = 0; i < 10; i++)
     clock_gettime (CLOCK_REALTIME, ts + i);
   for (i = 0; i < 10; i++)
     printf ("%d: %lus %luns\n", i, ts[i].tv_sec, ts[i].tv_nsec);

   return 0;
}

=>

res: 0s 10000000ns
0: 1328779203s 975317500ns
1: 1328779203s 975317900ns
2: 1328779203s 975318200ns
3: 1328779203s 975318400ns
4: 1328779203s 975318600ns
5: 1328779203s 975318800ns
6: 1328779203s 975319000ns
7: 1328779203s 975319300ns
8: 1328779203s 975319500ns
9: 1328779203s 975319600ns

Old Sun Fire 880, SunOS 5.10 Generic_139555-08.

100ns precision with 10ms "finest timer unit"???

Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ