~ubuntu-branches/ubuntu/oneiric/jabberd2/oneiric-security

« back to all changes in this revision

Viewing changes to subst/gettimeofday.c

  • Committer: Bazaar Package Importer
  • Author(s): Nicolai Spohrer
  • Date: 2008-08-12 16:13:43 UTC
  • mfrom: (1.1.3 upstream) (0.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20080812161343-6trz3r97dtevxd17
Tags: 2.2.1-1ubuntu1
* Merge with Debian unstable (LP: #257130), remaining changes:
  - debian/control:
    + Modify Maintainer field as per spec
    + Depend on libdb4.6-dev instead of libdb4.4-dev
    + Added Conflicts and Replaces: ..., jabber for jabberd2
  - debian/rules: Added libtoolize call (jabberd2 ships with
     an older ltmain.sh version that conflicts with the
     current libtool version)
  - debian/init: create /var/run/jabber directory with correct
     permissions
* Dropped changes:
  - Debian already depends on libpq-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * $PostgreSQL: /cvsroot/pgsql-server/src/port/gettimeofday.c,v 1.3 2003/11/29 19:52:13 pgsql Exp $
3
 
 *
4
 
 * Copyright (c) 2003 SRA, Inc.
5
 
 * Copyright (c) 2003 SKC, Inc.
6
 
 *
7
 
 * Permission to use, copy, modify, and distribute this software and
8
 
 * its documentation for any purpose, without fee, and without a
9
 
 * written agreement is hereby granted, provided that the above
10
 
 * copyright notice and this paragraph and the following two
11
 
 * paragraphs appear in all copies.
12
 
 *
13
 
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT,
14
 
 * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
15
 
 * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
16
 
 * DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED
17
 
 * OF THE POSSIBILITY OF SUCH DAMAGE.
18
 
 *
19
 
 * THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
20
 
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
 
 * A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS
22
 
 * IS" BASIS, AND THE AUTHOR HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE,
23
 
 * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24
 
 */
25
 
 
26
 
#ifdef HAVE_CONFIG_H
27
 
# include "config.h"
28
 
#endif
29
 
 
30
 
#ifndef HAVE_GETTIMEOFDAY
31
 
 
32
 
#include "ac-stdint.h"
33
 
 
34
 
#include <time.h>
35
 
#include <stdio.h>
36
 
#include <sys/types.h>
37
 
#include <sys/timeb.h>
38
 
#include <windows.h>
39
 
 
40
 
#include "subst.h"
41
 
 
42
 
/* FILETIME of Jan 1 1970 00:00:00. */
43
 
static const unsigned __int64 epoch = 116444736000000000L;
44
 
 
45
 
/*
46
 
 * timezone information is stored outside the kernel so tzp isn't used anymore.
47
 
 */
48
 
 
49
 
int
50
 
gettimeofday(struct timeval * tp, struct timezone * tzp)
51
 
{
52
 
        FILETIME        file_time;
53
 
        SYSTEMTIME      system_time;
54
 
        ULARGE_INTEGER ularge;
55
 
 
56
 
        GetSystemTime(&system_time);
57
 
        SystemTimeToFileTime(&system_time, &file_time);
58
 
        ularge.LowPart = file_time.dwLowDateTime;
59
 
        ularge.HighPart = file_time.dwHighDateTime;
60
 
 
61
 
        tp->tv_sec = (long) ((ularge.QuadPart - epoch) / 10000000L);
62
 
        tp->tv_usec = (long) (system_time.wMilliseconds * 1000);
63
 
 
64
 
        return 0;
65
 
}
66
 
 
67
 
#endif