~ubuntu-branches/ubuntu/saucy/haproxy/saucy

« back to all changes in this revision

Viewing changes to src/time.c

  • Committer: Package Import Robot
  • Author(s): Vincent Bernat, Apollon Oikonomopoulos, Vincent Bernat, Prach Pongpanich
  • Date: 2013-05-06 20:02:14 UTC
  • mfrom: (1.3.1)
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: package-import@ubuntu.com-20130506200214-36s6p81fsa5zqybt
[ Apollon Oikonomopoulos ]
* New upstream version (Closes: #643650, #678953)
   + This fixes CVE-2012-2942 (Closes: #674447)
   + This fixes CVE-2013-1912 (Closes: #704611)
* Ship vim addon as vim-haproxy (Closes: #702893)
* Check for the configuration file after sourcing /etc/default/haproxy
  (Closes: #641762)
* Use /dev/log for logging by default (Closes: #649085)

[ Vincent Bernat ]
* debian/control:
   + add Vcs-* fields
   + switch maintenance to Debian HAProxy team. (Closes: #706890)
   + drop dependency to quilt: 3.0 (quilt) format is in use.
* debian/rules:
   + don't explicitly call dh_installchangelog.
   + use dh_installdirs to install directories.
   + use dh_install to install error and configuration files.
   + switch to `linux2628` Makefile target for Linux.
* debian/postrm:
   + remove haproxy user and group on purge.
* Ship a more minimal haproxy.cfg file: no `listen` blocks but `global`
  and `defaults` block with appropriate configuration to use chroot and
  logging in the expected way.

[ Prach Pongpanich ]
* debian/copyright:
   + add missing copyright holders
   + update years of copyright
* debian/rules:
   + build with -Wl,--as-needed to get rid of unnecessary depends
* Remove useless files in debian/haproxy.{docs,examples}
* Update debian/watch file, thanks to Bart Martens

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
#include <common/standard.h>
17
17
#include <common/time.h>
18
18
 
19
 
unsigned int   curr_sec_ms;      /* millisecond of current second (0..999) */
20
 
unsigned int   curr_sec_ms_scaled;  /* millisecond of current second (0..2^32-1) */
 
19
unsigned int   curr_sec_ms;     /* millisecond of current second (0..999) */
 
20
unsigned int   ms_left_scaled;  /* milliseconds left for current second (0..2^32-1) */
21
21
unsigned int   now_ms;          /* internal date in milliseconds (may wrap) */
22
22
struct timeval now;             /* internal date is a monotonic function of real clock */
23
23
struct timeval date;            /* the real current date */
195
195
 to_ms:
196
196
        now = adjusted;
197
197
        curr_sec_ms = now.tv_usec / 1000;            /* ms of current second */
198
 
        curr_sec_ms_scaled = curr_sec_ms * 4294971;  /* ms * 2^32 / 1000 */
 
198
 
 
199
        /* For frequency counters, we'll need to know the ratio of the previous
 
200
         * value to add to current value depending on the current millisecond.
 
201
         * The principle is that during the first millisecond, we use 999/1000
 
202
         * of the past value and that during the last millisecond we use 0/1000
 
203
         * of the past value. In summary, we only use the past value during the
 
204
         * first 999 ms of a second, and the last ms is used to complete the
 
205
         * current measure. The value is scaled to (2^32-1) so that a simple
 
206
         * multiply followed by a shift gives us the final value.
 
207
         */
 
208
        ms_left_scaled = (999U - curr_sec_ms) * 4294967U;
199
209
        now_ms = now.tv_sec * 1000 + curr_sec_ms;
200
210
        return;
201
211
}