Changeset ca44f82 in network-game for common/Common.cpp


Ignore:
Timestamp:
Feb 24, 2013, 1:28:32 AM (12 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
7b43385
Parents:
3a79253 (diff), 8f85180 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Updated files to correctly compile on Windows

File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/Common.cpp

    r3a79253 rca44f82  
    11#include "Common.h"
     2
     3#include <iostream>
     4using namespace std;
     5
     6#if defined WINDOWS
     7   #include <Windows.h>
     8#elif defined LINUX
     9   #include <time.h>
     10#endif
    211
    312void set_nonblock(int sock)
     
    1322   #endif
    1423}
     24
     25unsigned long long getCurrentMillis()
     26{
     27   unsigned long long numMilliseconds;
     28
     29   #if defined WINDOWS
     30      numMilliseconds = GetTickCount();
     31   #elif defined LINUX
     32      timespec curTime;
     33      clock_gettime(CLOCK_REALTIME, &curTime);
     34
     35      numMilliseconds = curTime.tv_sec*(unsigned long long)1000+curTime.tv_nsec/(unsigned long long)1000000;
     36   #endif
     37
     38   return numMilliseconds;
     39}
Note: See TracChangeset for help on using the changeset viewer.