- fix utc time for bsd, that also works for linux.
Patch by Daniel Gimpelevich
This commit is contained in:
parent
c55a676ec0
commit
e856e9c46e
@ -210,9 +210,8 @@
|
||||
#define BX_HAVE_MKSTEMP 0
|
||||
#define BX_HAVE_SYS_MMAN_H 0
|
||||
#define BX_HAVE_XPM_H 0
|
||||
#define BX_HAVE_LOCALTIME 0
|
||||
#define BX_HAVE_TIMEZONE 0
|
||||
#define BX_HAVE_DAYLIGHT 0
|
||||
#define BX_HAVE_GMTIME 0
|
||||
#define BX_HAVE_MKTIME 0
|
||||
|
||||
// This turns on Roland Mainz's idle hack. Presently it is specific to the X11
|
||||
// gui. If people try to enable it elsewhere, give a compile error after the
|
||||
|
@ -2,7 +2,7 @@ dnl // Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.50)
|
||||
AC_INIT(bochs.h)
|
||||
AC_REVISION([[$Id: configure.in,v 1.228 2003-10-01 02:11:39 bdenney Exp $]])
|
||||
AC_REVISION([[$Id: configure.in,v 1.229 2003-10-02 07:38:00 cbothamy Exp $]])
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
AC_CONFIG_HEADER(ltdlconf.h)
|
||||
|
||||
@ -151,9 +151,8 @@ AC_CHECK_MEMBER(struct sockaddr_in.sin_len, AC_DEFINE(BX_HAVE_SOCKADDR_IN_SIN_LE
|
||||
#include <netinet/in.h> ])
|
||||
AC_CHECK_FUNCS(mkstemp, AC_DEFINE(BX_HAVE_MKSTEMP))
|
||||
AC_CHECK_HEADER(sys/mman.h, AC_DEFINE(BX_HAVE_SYS_MMAN_H))
|
||||
AC_CHECK_FUNCS(localtime, AC_DEFINE(BX_HAVE_LOCALTIME))
|
||||
AC_CHECK_DECL(timezone, AC_DEFINE(BX_HAVE_TIMEZONE), , [#include <time.h>])
|
||||
AC_CHECK_DECL(daylight, AC_DEFINE(BX_HAVE_DAYLIGHT), , [#include <time.h>])
|
||||
AC_CHECK_FUNCS(gmtime, AC_DEFINE(BX_HAVE_GMTIME))
|
||||
AC_CHECK_FUNCS(mktime, AC_DEFINE(BX_HAVE_MKTIME))
|
||||
|
||||
dnl As of autoconf 2.53, the standard largefile test fails for Linux/gcc.
|
||||
dnl It does not put the largefiles arguments into CFLAGS, even though Linux/gcc
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: cmos.cc,v 1.41 2003-09-05 23:17:51 cbothamy Exp $
|
||||
// $Id: cmos.cc,v 1.42 2003-10-02 07:38:00 cbothamy Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -118,7 +118,7 @@ bx_cmos_c::~bx_cmos_c(void)
|
||||
void
|
||||
bx_cmos_c::init(void)
|
||||
{
|
||||
BX_DEBUG(("Init $Id: cmos.cc,v 1.41 2003-09-05 23:17:51 cbothamy Exp $"));
|
||||
BX_DEBUG(("Init $Id: cmos.cc,v 1.42 2003-10-02 07:38:00 cbothamy Exp $"));
|
||||
// CMOS RAM & RTC
|
||||
|
||||
DEV_register_ioread_handler(this, read_handler, 0x0070, "CMOS RAM", 1);
|
||||
@ -163,16 +163,12 @@ bx_cmos_c::init(void)
|
||||
|
||||
BX_CMOS_THIS s.timeval = time(NULL);
|
||||
|
||||
#if BX_HAVE_LOCALTIME
|
||||
localtime(&BX_CMOS_THIS s.timeval);
|
||||
#if BX_HAVE_TIMEZONE
|
||||
#if BX_HAVE_GMTIME && BX_HAVE_MKTIME
|
||||
utc_ok = 1;
|
||||
BX_CMOS_THIS s.timeval += timezone;
|
||||
#endif // BX_HAVE_TIMEZONE
|
||||
#if BX_HAVE_DAYLIGHT
|
||||
BX_CMOS_THIS s.timeval -= (daylight*3600);
|
||||
#endif // BX_HAVE_DAYLIGHT
|
||||
#endif // BX_HAVE_LOCALTIME
|
||||
struct tm *utc_holder = gmtime(&BX_CMOS_THIS s.timeval);
|
||||
utc_holder->tm_isdst = -1;
|
||||
BX_CMOS_THIS s.timeval = mktime(utc_holder);
|
||||
#endif // BX_HAVE_GMTIME && BX_HAVE_MKTIME
|
||||
|
||||
if (!utc_ok) {
|
||||
BX_ERROR(("UTC time is not supported on your platform. Using current localtime"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user