Changeset 2035:e92071fadd3f in lemon-0.x
- Timestamp:
- 04/03/06 21:47:37 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2674
- Location:
- lemon
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/Makefile.am
r2034 r2035 10 10 lp_skeleton.cc \ 11 11 base.cc \ 12 eps.cc 12 eps.cc \ 13 bits/mingw32_rand.cc \ 14 bits/mingw32_time.cc 15 13 16 libemon_la_CXXFLAGS = $(GLPK_CFLAGS) $(CPLEX_CFLAGS) 14 17 libemon_la_LDFLAGS = $(GLPK_LIBS) $(CPLEX_LIBS) … … 100 103 bits/traits.h \ 101 104 bits/utility.h \ 105 bits/mingw32_rand.h \ 106 bits/mingw32_time.h \ 102 107 concept/bpugraph.h \ 103 108 concept/graph.h \ -
lemon/bits/mingw32_time.h
r2028 r2035 23 23 24 24 #include <windows.h> 25 #include < time.h>25 #include <ctime> 26 26 #include "dos.h" 27 27 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 28 char *asctime_r(const struct tm *t, char *buf); 29 struct tm * localtime_r (const time_t *t, struct tm *tm); 30 char *ctime_r(const time_t * tim_p , char * result); 31 int gettimeofday(struct timeval * tp, struct timezone *); 91 32 92 33 struct tms { … … 97 38 }; 98 39 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; 40 long filetime_to_clock(FILETIME *ft); 106 41 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 } 42 int times(struct tms *tmbuf); 126 43 127 44 #define _SC_CLK_TCK 1 128 45 129 inline int sysconf(int) 130 { 131 return 1; 132 } 46 int sysconf(int); 133 47 134 48 #endif 135 49 136 137 50 #endif -
lemon/simann.h
r1956 r2035 32 32 #include <limits> 33 33 #include <lemon/time_measure.h> 34 35 #ifdef WIN32 36 #include <lemon/bits/mingw32_rand.h> 37 #endif 34 38 35 39 namespace lemon {
Note: See TracChangeset
for help on using the changeset viewer.