Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Charonxin committed Aug 9, 2023
1 parent 2f018f9 commit d2ac035
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 36 deletions.
24 changes: 0 additions & 24 deletions System/Classes/tm_timer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,6 @@
#include "string.hpp"
#include "tm_ostream.hpp"

#ifndef __FreeBSD__
#ifndef HAVE_TIME_T
#define HAVE_TIME_T
typedef long time_t;
#endif
#else
#include <time.h>
#endif

#ifdef OS_SUN
#include <sys/types.h>
#endif

#ifdef HAVE_GETTIMEOFDAY
#include <sys/time.h>
#else
#include <sys/timeb.h>
#ifdef OS_SUN
extern "C" {
extern int ftime __P ((struct timeb * __timebuf));
};
#endif
#endif

time_t raw_time ();
time_t texmacs_time ();

Expand Down
42 changes: 32 additions & 10 deletions System/config_l1.h.xmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
${define HAVE_INTPTR_T}
${define HAVE_STDINT_H}
${define HAVE_INTTYPES_H}
${define HAVE_TIME_T}
${define HAVE_GETTIMEOFDAY}
${define HAVE_INTPTR_T} ${define HAVE_STDINT_H} ${define HAVE_INTTYPES_H} ${
define HAVE_TIME_T} ${define HAVE_GETTIMEOFDAY} ${define __FreeBSD__} $ {
define OS_SUN
}

#ifdef HAVE_INTPTR_T
#ifdef HAVE_INTTYPES_H
Expand All @@ -15,8 +14,31 @@ ${define HAVE_GETTIMEOFDAY}
typedef long intptr_t;
#endif

${define SANITY_CHECKS}
${define OS_MINGW}
${define OS_WIN32}
${define MIMALLOC}
${define JEMALLOC}
#ifndef __FreeBSD__
#ifndef HAVE_TIME_T
#define HAVE_TIME_T
typedef long time_t;
#endif
#else
#include <time.h>
#endif

#ifdef OS_SUN
#include <sys/types.h>
#endif

#ifdef HAVE_GETTIMEOFDAY
#include <sys/time.h>
#else
#include <sys/timeb.h>
#ifdef OS_SUN
extern "C" {
extern int ftime __P ((struct timeb * __timebuf));
};
#endif
#endif

${define SANITY_CHECKS} ${define OS_MINGW} ${define OS_WIN32} ${
define MIMALLOC} $ {
define JEMALLOC
}
4 changes: 2 additions & 2 deletions tests/System/Classes/tm_timer_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ to_zero (tm_ostream& out) {
}

TEST_CASE ("function raw_time") {
long startTime= raw_time ();
unsigned int startTime= raw_time ();

CHECK (startTime >= 0);

long endTime= raw_time ();
unsigned int endTime= raw_time ();

CHECK (endTime >= startTime);
}
Expand Down

0 comments on commit d2ac035

Please sign in to comment.