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