COIN-OR::LEMON - Graph Library

Changeset 2035:e92071fadd3f in lemon-0.x


Ignore:
Timestamp:
04/03/06 21:47:37 (14 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2674
Message:

More mingw compatibility

Implementation of the drand48 functions

Location:
lemon
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • lemon/Makefile.am

    r2034 r2035  
    1010        lp_skeleton.cc \
    1111        base.cc \
    12         eps.cc
     12        eps.cc \
     13        bits/mingw32_rand.cc \
     14        bits/mingw32_time.cc
     15
    1316libemon_la_CXXFLAGS = $(GLPK_CFLAGS) $(CPLEX_CFLAGS)
    1417libemon_la_LDFLAGS = $(GLPK_LIBS) $(CPLEX_LIBS)
     
    100103        bits/traits.h \
    101104        bits/utility.h \
     105        bits/mingw32_rand.h \
     106        bits/mingw32_time.h \
    102107        concept/bpugraph.h \
    103108        concept/graph.h \
  • lemon/bits/mingw32_time.h

    r2028 r2035  
    2323
    2424#include <windows.h>
    25 #include <time.h>
     25#include <ctime>
    2626#include "dos.h"
    2727
    28 static const char days[] =
    29 "Sun Mon Tue Wed Thu Fri Sat ";
    30 static const char months[] =
    31 "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ";
    32 
    33 inline void num2str(char *c,int i) {
    34   c[0]=i/10+'0';
    35   c[1]=i%10+'0';
    36 }
    37 
    38 inline char *asctime_r(const struct tm *t, char *buf) {
    39   /* "Wed Jun 30 21:49:08 1993\n" */
    40   *(int*)buf=*(int*)(days+(t->tm_wday<<2));
    41   *(int*)(buf+4)=*(int*)(months+(t->tm_mon<<2));
    42   num2str(buf+8,t->tm_mday);
    43   if (buf[8]=='0') buf[8]=' ';
    44   buf[10]=' ';
    45   num2str(buf+11,t->tm_hour);
    46   buf[13]=':';
    47   num2str(buf+14,t->tm_min);
    48   buf[16]=':';
    49   num2str(buf+17,t->tm_sec);
    50   buf[19]=' ';
    51   num2str(buf+20,(t->tm_year+1900)/100);
    52   num2str(buf+22,(t->tm_year+1900)%100);
    53   buf[24]='\n'; buf[25]='\0';
    54   return buf;
    55 }
    56 
    57 inline struct tm * localtime_r (const time_t *t, struct tm *tm) {
    58   struct tm *tmp;
    59  
    60   if ((tmp = localtime(t)) && tm)
    61     *tm = *tmp;
    62   else
    63     return 0;
    64  
    65   return tm;
    66 }
    67 
    68 inline char *ctime_r(const time_t * tim_p , char * result) {
    69   struct tm tm;
    70   return asctime_r (localtime_r (tim_p, &tm), result);
    71 }
    72 
    73 
    74 inline int gettimeofday(struct timeval * tp, struct timezone *) {
    75   SYSTEMTIME systime;
    76 
    77   if (tp) {
    78     struct tm tmrec;
    79     time_t theTime = time(NULL);
    80    
    81    
    82     tmrec = *localtime(&theTime);
    83     tp->tv_sec = mktime(&tmrec);
    84     GetLocalTime(&systime); /* system time */
    85 
    86     tp->tv_usec = systime.wMilliseconds * 1000;
    87   }
    88   return 0;
    89 }
    90 
     28char *asctime_r(const struct tm *t, char *buf);
     29struct tm * localtime_r (const time_t *t, struct tm *tm);
     30char *ctime_r(const time_t * tim_p , char * result);
     31int gettimeofday(struct timeval * tp, struct timezone *);
    9132
    9233struct tms {
     
    9738};
    9839
    99 inline long filetime_to_clock(FILETIME *ft)
    100 {
    101   __int64 qw = ft->dwHighDateTime;
    102   qw <<= 32;
    103   qw |= ft->dwLowDateTime;
    104   qw /= 10000;  /* File time ticks at 0.1uS, clock at 1mS */
    105   return (long) qw;
     40long filetime_to_clock(FILETIME *ft);
    10641
    107 }
    108 
    109 inline int times(struct tms *tmbuf)
    110 {
    111   FILETIME create, exit, kernel, user;
    112   if (GetProcessTimes(GetCurrentProcess(),&create, &exit, &kernel, &user)) {
    113     tmbuf->tms_utime = filetime_to_clock(&user);
    114     tmbuf->tms_stime = filetime_to_clock(&kernel);
    115     tmbuf->tms_cutime = 0;
    116     tmbuf->tms_cstime = 0;
    117   }
    118   else {
    119     tmbuf->tms_utime = clock();
    120     tmbuf->tms_stime = 0;
    121     tmbuf->tms_cutime = 0;
    122     tmbuf->tms_cstime = 0;
    123   }
    124   return 0;
    125 }
     42int times(struct tms *tmbuf);
    12643
    12744#define _SC_CLK_TCK 1
    12845
    129 inline int sysconf(int)
    130 {
    131   return 1;
    132 }
     46int sysconf(int);
    13347
    13448#endif
    13549
    136 
    13750#endif
  • lemon/simann.h

    r1956 r2035  
    3232#include <limits>
    3333#include <lemon/time_measure.h>
     34
     35#ifdef WIN32
     36#include <lemon/bits/mingw32_rand.h>
     37#endif
    3438
    3539namespace lemon {
Note: See TracChangeset for help on using the changeset viewer.