Here's a diff to replace ftime() with gettimeofday() in emulators/fs-uae.

Unfortunately, this is strictly a local diff.  Upstream purposely
uses ftime() for portability between Unix and MS-Windows.  There's
a variety of ways to handle this--sprinkle some #ifdef's, add a
gettimeofday() implementation for Windows--but that's really something
for upstream to decide.  Edd, can you talk to them?  gettimeofday()
is available on all UNIX/POSIX platforms and has rendered ftime()
obsolete 30 (!) years ago.

Index: Makefile
===================================================================
RCS file: /cvs/ports/emulators/fs-uae/Makefile,v
retrieving revision 1.13
diff -u -p -r1.13 Makefile
--- Makefile    10 Sep 2013 10:23:34 -0000      1.13
+++ Makefile    1 Dec 2013 22:48:23 -0000
@@ -6,7 +6,7 @@ BROKEN-sparc64 =        error: invalid 'asm': i
 
 COMMENT =              modern Amiga emulator
 V =                    2.2.3
-REVISION =             0
+REVISION =             1
 MODPY_EGG_VERSION =    ${V}
 DISTNAME =             fs-uae-$V
 CATEGORIES =           emulators
Index: patches/patch-Makefile
===================================================================
RCS file: /cvs/ports/emulators/fs-uae/patches/patch-Makefile,v
retrieving revision 1.3
diff -u -p -r1.3 patch-Makefile
--- patches/patch-Makefile      10 Sep 2013 10:23:35 -0000      1.3
+++ patches/patch-Makefile      1 Dec 2013 22:48:23 -0000
@@ -2,8 +2,8 @@ $OpenBSD: patch-Makefile,v 1.3 2013/09/1
 
 Disable custom optimisation flags.
 
---- Makefile.orig      Sun Mar 24 23:49:51 2013
-+++ Makefile   Sun Mar 24 23:50:00 2013
+--- Makefile.orig      Tue Jun 25 21:21:16 2013
++++ Makefile   Sun Dec  1 23:43:29 2013
 @@ -88,14 +88,6 @@ endif
  profile_generate := 0
  profile_use := 0
@@ -19,3 +19,12 @@ Disable custom optimisation flags.
  ifeq ($(profile_generate), 1)
        cflags += -fprofile-generate
        cxxflags += -fprofile-generate
+@@ -154,7 +146,7 @@ else ifeq ($(os), freebsd)
+   libs += -lGL -lGLU -lopenal -lX11 -lcompat
+ else ifeq ($(os), openbsd)
+   cppflags += -DOPENBSD
+-  libs += -lGL -lGLU -lopenal -lX11 -lcompat
++  libs += -lGL -lGLU -lopenal -lX11
+ else
+   cppflags += -DLINUX
+   ldflags += -Wa,--execstack
Index: patches/patch-src_blkdev_cdimage_cpp
===================================================================
RCS file: patches/patch-src_blkdev_cdimage_cpp
diff -N patches/patch-src_blkdev_cdimage_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_blkdev_cdimage_cpp        1 Dec 2013 22:48:23 -0000
@@ -0,0 +1,40 @@
+$OpenBSD$
+
+Replace ftime() by gettimeofday().
+
+--- src/blkdev_cdimage.cpp.orig        Tue Jun 25 21:21:17 2013
++++ src/blkdev_cdimage.cpp     Sun Dec  1 23:41:31 2013
+@@ -13,7 +13,7 @@
+ #include "sysconfig.h"
+ #include "sysdeps.h"
+ 
+-#include <sys/timeb.h>
++#include <sys/time.h>
+ 
+ #include "options.h"
+ #include "blkdev.h"
+@@ -375,11 +375,11 @@ static void *cdda_play_func (void *v)
+               if (oldplay != cdu->cdda_play) {
+                       struct cdtoc *t;
+                       int sector, diff;
+-                      struct _timeb tb1, tb2;
++                      struct timeval tb1, tb2;
+ 
+                       idleframes = 0;
+                       foundsub = false;
+-                      _ftime (&tb1);
++                      gettimeofday (&tb1, NULL);
+                       cdda_pos = cdu->cdda_start;
+                       oldplay = cdu->cdda_play;
+                       sector = cdu->cd_last_pos = cdda_pos;
+@@ -434,8 +434,8 @@ static void *cdda_play_func (void *v)
+                       }
+                       cdda_pos -= idleframes;
+ 
+-                      _ftime (&tb2);
+-                      diff = (tb2.time * (uae_s64)1000 + tb2.millitm) - 
(tb1.time * (uae_s64)1000 + tb1.millitm);
++                      gettimeofday (&tb2, NULL);
++                      diff = (tb2.tv_sec * (uae_s64)1000 + tb2.tv_usec / 
1000) - (tb1.tv_sec * (uae_s64)1000 + tb1.tv_usec / 1000);
+                       diff -= cdu->cdda_delay;
+                       if (idleframes >= 0 && diff < 0 && cdu->cdda_play > 0)
+                               Sleep (-diff);
-- 
Christian "naddy" Weisgerber                          na...@mips.inka.de

Reply via email to