~ubuntu-branches/debian/sid/nss-pam-ldapd/sid

« back to all changes in this revision

Viewing changes to tests/test_clock.c

  • Committer: Package Import Robot
  • Author(s): Arthur de Jong
  • Date: 2015-04-10 16:00:00 UTC
  • mfrom: (16.1.9)
  • Revision ID: package-import@ubuntu.com-20150410160000-hf3a58ogc1dr4gzv
Tags: 0.9.5-1
* new upstream release:
  - handle situation better when server (or firewall) closed the connection
    (thanks Tim Harder)
  - make daemonising a little more robust and try to log more failures
  - fix integer format strings (thanks Jianhai Luan and Patrick McLean)
  - documentation updates (thanks Dalibor Pospíšil)
  - fix range check for search access (thanks David Binderma)
  - fix a bug in the NSS library when encountering IPv6 addresses in
    the hosts map (thanks Mark R Bannister)
  - adjust the Linux OOM (Out-Of-Memory) killer score to avoid killing
    nslcd (thanks Patrick McLean)
* drop use-ip-range-for-tests.patch which is part of 0.9.5
* debian/copyright: copyright year updates
* upgrade to standards-version 3.9.6 (no changes needed)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
   test_clock.c - tests for finding usable system clocks
3
3
   This file is part of the nss-pam-ldapd library.
4
4
 
5
 
   Copyright (C) 2013 Arthur de Jong
 
5
   Copyright (C) 2013-2015 Arthur de Jong
6
6
 
7
7
   This library is free software; you can redistribute it and/or
8
8
   modify it under the terms of the GNU Lesser General Public
73
73
  else
74
74
    printf("OK   clock %s time: %ld.%09ld\n", cname, (long)t4.tv_sec, (long)t4.tv_nsec);
75
75
  /* calculate difference */
76
 
  diff = ((long)t4.tv_sec - (long)t2.tv_sec - (long)t3.tv_sec) * (long)1000000000 +
 
76
  diff = ((long)t4.tv_sec - (long)t2.tv_sec - (long)t3.tv_sec) * 1000000000L +
77
77
         ((long)t4.tv_nsec - (long)t2.tv_nsec - (long)t3.tv_nsec);
78
78
  if ((diff < (-10 * 1000 * 1000)) || (diff > (20 * 1000 * 1000)))
79
79
  {
84
84
    printf("OK   ");
85
85
  printf("clock %s time diff: %s%ld.%09ld %.1f%%\n", cname, (diff < 0) ? "-" : "",
86
86
         (labs(diff) / 1000000000L), (labs(diff) % 1000000000L),
87
 
         labs(100L * diff) / (float)((long)t3.tv_sec * 1000000000L + (long)t3.tv_nsec));
 
87
         (float)labs(diff) / (float)((long)t3.tv_sec * 10000000L + (long)t3.tv_nsec / 100));
88
88
  return result;
89
89
}
90
90