Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filling in GetTickCount for non windows #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/seatest.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#include "seatest.h"

#define SECONDS_TO_MILLISECONDS(sec) sec * 1000
#define MICRO_SECONDS_TO_MILLISECONDS(microsec) microsec / 1000

#include <string.h>
#ifdef WIN32
#include "windows.h"
Expand All @@ -10,7 +14,14 @@ int seatest_is_string_equal_i(const char* s1, const char* s2)

#else
#include <strings.h>
unsigned int GetTickCount() { return 0;}
#include <sys/time.h>

unsigned int GetTickCount() {
struct timeval current_time;
gettimeofday(&current_time, NULL);
return SECONDS_TO_MILLISECONDS(current_time.tv_sec) + MICRO_SECONDS_TO_MILLISECONDS(current_time.tv_usec);
}

void _getch( void ) { }
int seatest_is_string_equal_i(const char* s1, const char* s2)
{
Expand Down