[mapserver-commits] r12916 - in trunk/mapserver/mapcache: . include
src
svn at osgeo.org
svn at osgeo.org
Fri Dec 23 11:45:22 EST 2011
Author: assefa
Date: 2011-12-23 08:45:22 -0800 (Fri, 23 Dec 2011)
New Revision: 12916
Modified:
trunk/mapserver/mapcache/Makefile.vc
trunk/mapserver/mapcache/include/util.h
trunk/mapserver/mapcache/src/mapcache_seed.c
trunk/mapserver/mapcache/src/util.c
Log:
add windows functions #4106
Modified: trunk/mapserver/mapcache/Makefile.vc
===================================================================
--- trunk/mapserver/mapcache/Makefile.vc 2011-12-23 16:43:39 UTC (rev 12915)
+++ trunk/mapserver/mapcache/Makefile.vc 2011-12-23 16:45:22 UTC (rev 12916)
@@ -30,7 +30,7 @@
src\cache_tiff.obj src\image.obj src\service_demo.obj src\source_mapserver.obj \
src\configuration.obj src\image_error.obj src\service_kml.obj src\source_wms.obj \
src\configuration_xml.obj src\imageio.obj src\service_tms.obj src\tileset.obj \
- src\core.obj src\imageio_jpeg.obj src\service_ve.obj src\util.obj \
+ src\core.obj src\imageio_jpeg.obj src\service_ve.obj src\util.obj src\strptime.obj \
$(REGEX_OBJ)
Modified: trunk/mapserver/mapcache/include/util.h
===================================================================
--- trunk/mapserver/mapcache/include/util.h 2011-12-23 16:43:39 UTC (rev 12915)
+++ trunk/mapserver/mapcache/include/util.h 2011-12-23 16:45:22 UTC (rev 12916)
@@ -88,7 +88,19 @@
#endif
+#if defined(_WIN32)
+struct mctimeval {
+ long tv_sec; /* seconds */
+ long tv_usec; /* and microseconds */
+};
+void mapcache_gettimeofday(struct mctimeval *t, void *__not_used_here__);
+#else
+# include <sys/time.h> /* for gettimeofday() */
+# define mctimeval timeval
+# define mapcache_gettimeofday(t,u) gettimeofday(t,u)
+#endif
+
#endif /* UTIL_H_ */
/* vim: ai ts=3 sts=3 et sw=3
*/
Modified: trunk/mapserver/mapcache/src/mapcache_seed.c
===================================================================
--- trunk/mapserver/mapcache/src/mapcache_seed.c 2011-12-23 16:43:39 UTC (rev 12915)
+++ trunk/mapserver/mapcache/src/mapcache_seed.c 2011-12-23 16:45:22 UTC (rev 12916)
@@ -70,7 +70,7 @@
apr_time_t age_limit = 0;
int seededtilestot=0, seededtiles=0, queuedtilestot=0;
-struct timeval lastlogtime,starttime;
+struct mctimeval lastlogtime,starttime;
typedef enum {
MAPCACHE_CMD_SEED,
@@ -204,12 +204,12 @@
return;
if(queuedtilestot>nthreads) {
- struct timeval now_t;
+ struct mctimeval now_t;
float duration;
float totalduration;
seededtilestot = queuedtilestot - nthreads;
- gettimeofday(&now_t,NULL);
+ mapcache_gettimeofday(&now_t,NULL);
duration = ((now_t.tv_sec-lastlogtime.tv_sec)*1000000+(now_t.tv_usec-lastlogtime.tv_usec))/1000000.0;
totalduration = ((now_t.tv_sec-starttime.tv_sec)*1000000+(now_t.tv_usec-starttime.tv_usec))/1000000.0;
if(duration>=5) {
@@ -620,7 +620,7 @@
apr_getopt_init(&opt, ctx.pool, argc, argv);
seededtiles=seededtilestot=queuedtilestot=0;
- gettimeofday(&starttime,NULL);
+ mapcache_gettimeofday(&starttime,NULL);
lastlogtime=starttime;
argdimensions = apr_table_make(ctx.pool,3);
@@ -950,9 +950,9 @@
}
if(seededtilestot>0) {
- struct timeval now_t;
+ struct mctimeval now_t;
float duration;
- gettimeofday(&now_t,NULL);
+ mapcache_gettimeofday(&now_t,NULL);
duration = ((now_t.tv_sec-starttime.tv_sec)*1000000+(now_t.tv_usec-starttime.tv_usec))/1000000.0;
printf("\nseeded %d metatiles at %g tiles/sec\n",seededtilestot, seededtilestot/duration);
}
Modified: trunk/mapserver/mapcache/src/util.c
===================================================================
--- trunk/mapserver/mapcache/src/util.c 2011-12-23 16:43:39 UTC (rev 12915)
+++ trunk/mapserver/mapcache/src/util.c 2011-12-23 16:45:22 UTC (rev 12916)
@@ -218,3 +218,58 @@
/* vim: ai ts=3 sts=3 et sw=3
*/
+
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+
+int strncasecmp(const char *s1, const char *s2, int len)
+{
+ register const char *cp1, *cp2;
+ int cmp = 0;
+
+ cp1 = s1;
+ cp2 = s2;
+
+ if(len == 0)
+ return(0);
+
+ if (!*cp1)
+ return -1;
+ else if (!*cp2)
+ return 1;
+
+ while(*cp1 && *cp2 && len)
+ {
+ if((cmp = (toupper(*cp1) - toupper(*cp2))) != 0)
+ return(cmp);
+ cp1++;
+ cp2++;
+ len--;
+ }
+
+ if(len == 0) {
+ return(0);
+ }
+ if(*cp1 || *cp2)
+ {
+ if (*cp1)
+ return(1);
+ else
+ return (-1);
+ }
+ return(0);
+}
+
+
+#include <sys/timeb.h>
+void mapcache_gettimeofday(struct mctimeval* tp, void* tzp)
+{
+ struct _timeb theTime;
+
+ _ftime(&theTime);
+ tp->tv_sec = theTime.time;
+ tp->tv_usec = theTime.millitm * 1000;
+}
+
+
+#endif
More information about the mapserver-commits
mailing list