Changeset 535


Ignore:
Timestamp:
02/06/09 01:21:32 (3 years ago)
Author:
mooneer
Message:

Kite now compiles in Windows again.

Location:
interpreter/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • interpreter/trunk/modules/System/date/hires.c

    r531 r535  
    44#ifndef WIN32 
    55#include <unistd.h> 
     6#include <sys/time.h> 
     7#else 
     8#include <time.h> 
     9#include <Winsock2.h> 
    610#endif /* WIN32 */ 
    711#include <errno.h> 
    812#define __USE_XOPEN 
    9 #include <sys/time.h> 
     13 
     14#ifdef WIN32 
     15#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) 
     16  #define DELTA_EPOCH_IN_MICROSECS  11644473600000000Ui64 
     17#else 
     18  #define DELTA_EPOCH_IN_MICROSECS  11644473600000000ULL 
     19#endif 
     20  
     21struct timezone  
     22{ 
     23  int  tz_minuteswest; /* minutes W of Greenwich */ 
     24  int  tz_dsttime;     /* type of dst correction */ 
     25}; 
     26  
     27int gettimeofday(struct timeval *tv, struct timezone *tz) 
     28{ 
     29  FILETIME ft; 
     30  unsigned __int64 tmpres = 0; 
     31  static int tzflag; 
     32  
     33  if (NULL != tv) 
     34  { 
     35    GetSystemTimeAsFileTime(&ft); 
     36  
     37    tmpres |= ft.dwHighDateTime; 
     38    tmpres <<= 32; 
     39    tmpres |= ft.dwLowDateTime; 
     40  
     41    /*converting file time to unix epoch*/ 
     42    tmpres /= 10;  /*convert into microseconds*/ 
     43    tmpres -= DELTA_EPOCH_IN_MICROSECS;  
     44    tv->tv_sec = (long)(tmpres / 1000000UL); 
     45    tv->tv_usec = (long)(tmpres % 1000000UL); 
     46  } 
     47  
     48  if (NULL != tz) 
     49  { 
     50    if (!tzflag) 
     51    { 
     52      _tzset(); 
     53      tzflag++; 
     54    } 
     55    tz->tz_minuteswest = _timezone / 60; 
     56    tz->tz_dsttime = _daylight; 
     57  } 
     58  
     59  return 0; 
     60} 
     61#endif /* WIN32 */ 
    1062 
    1163#include "kite_object.h" 
  • interpreter/trunk/windows/libkite.vcproj

    r527 r535  
    473473                                                </File> 
    474474                                        </Filter> 
     475                                        <Filter 
     476                                                Name="collections" 
     477                                                > 
     478                                                <File 
     479                                                        RelativePath="..\modules\System\collections\array.c" 
     480                                                        > 
     481                                                </File> 
     482                                        </Filter> 
    475483                                </Filter> 
    476484                                <Filter 
Note: See TracChangeset for help on using the changeset viewer.