Skip to content

Commit

Permalink
Merge pull request ggerganov#48 from richinseattle/richinseattle-patch-1
Browse files Browse the repository at this point in the history
MSVC Compatibility fix for timer
  • Loading branch information
karpathy authored Jul 24, 2023
2 parents cae88df + b2857c6 commit d18e9ef
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions run.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Then run with:
#include <time.h>
#include <math.h>
#include <string.h>
#include <sys/time.h>

// ----------------------------------------------------------------------------
// Transformer and RunState structs, and related memory management
Expand Down Expand Up @@ -378,9 +377,9 @@ int argmax(float* v, int n) {
// ----------------------------------------------------------------------------

long time_in_ms() {
struct timeval time;
gettimeofday(&time, NULL);
return time.tv_sec * 1000 + time.tv_usec / 1000;
struct timespec time;
timespec_get(&time, TIME_UTC);
return time.tv_sec * 1000 + time.tv_nsec / 1000000;
}

int main(int argc, char *argv[]) {
Expand Down

0 comments on commit d18e9ef

Please sign in to comment.