/*
 * Copyright (C) 2008 The Trustees of Columbia University in the City of New York. 
 * All rights reserved.
 *
 * See the file LICENSE included in this distribution for details.
 */

#ifndef _GETTIMEOFDAY_H
#define _GETTIMEOFDAY_H

#include <stdio.h>

#ifndef _WENGO
#include "types.h"
#endif

#ifdef _WENGO
#include "p2pp/common/types.h"
#endif

#ifdef _LINUX_
#include <sys/time.h>
#endif

#ifdef WIN32
#define EINVAL 22

#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) || defined(__WATCOMC__)
  #define DELTA_EPOCH_IN_USEC  11644473600000000Ui64
#else
  #define DELTA_EPOCH_IN_USEC  11644473600000000ULL
#endif

#include <winsock.h>

int gettimeofday (struct timeval *tv, void *tz);

typedef unsigned __int64 int64;
#endif


struct timeval difftimeval(const struct timeval& after, const struct timeval& before) ;
struct timeval addtimeval(struct timeval calc_time, uint32 sec, uint32 usec);

void printlocaltime( FILE *fp);

#endif

