00001 /****************************************************************************/ 00007 // 00008 /****************************************************************************/ 00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00010 // Copyright 2001-2010 DLR (http://www.dlr.de/) and contributors 00011 /****************************************************************************/ 00012 // 00013 // This program is free software; you can redistribute it and/or modify 00014 // it under the terms of the GNU General Public License as published by 00015 // the Free Software Foundation; either version 2 of the License, or 00016 // (at your option) any later version. 00017 // 00018 /****************************************************************************/ 00019 // =========================================================================== 00020 // included modules 00021 // =========================================================================== 00022 #ifdef _MSC_VER 00023 #include <windows_config.h> 00024 #else 00025 #include <config.h> 00026 #endif 00027 00028 #include "SysUtils.h" 00029 00030 #ifndef WIN32 00031 #include <sys/time.h> 00032 #else 00033 #include <windows.h> 00034 #endif 00035 00036 #ifdef CHECK_MEMORY_LEAKS 00037 #include <foreign/nvwa/debug_new.h> 00038 #endif // CHECK_MEMORY_LEAKS 00039 00040 00041 // =========================================================================== 00042 // member method definitions 00043 // =========================================================================== 00044 long 00045 SysUtils::getCurrentMillis() { 00046 #ifndef WIN32 00047 timeval current; 00048 gettimeofday(¤t, 0); 00049 long nanosecs = 00050 (long) current.tv_sec * 1000L + (long) current.tv_usec / 1000L; 00051 return nanosecs; 00052 #else 00053 LARGE_INTEGER val, val2; 00054 BOOL check = QueryPerformanceCounter(&val); 00055 check = QueryPerformanceFrequency(&val2); 00056 return (long)(val.QuadPart*1000/val2.QuadPart); 00057 #endif 00058 } 00059 00060 00061 00062 /****************************************************************************/ 00063
1.5.6