2017-04-15 21:19 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* src/common/hbdate.c
    * implemented monotonic timers in POSIX and MS-Windows builds

  * config/wce/global.mk
  * config/wce/mingwarm.mk
  * config/win/global.mk
  * utils/hbmk2/hbmk2.prg
    * added winmm/mmtimer to list of system libraries - required
      for timeGetTime()

  * ChangeLog.txt
    ! typos
This commit is contained in:
Przemysław Czerpak
2017-04-15 21:19:51 +02:00
parent 63dbef88f4
commit 52c588287e
11 changed files with 88 additions and 18 deletions

View File

@@ -10,6 +10,20 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2017-04-15 21:19 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/common/hbdate.c
* implemented monotonic timers in POSIX and MS-Windows builds
* config/wce/global.mk
* config/wce/mingwarm.mk
* config/win/global.mk
* utils/hbmk2/hbmk2.prg
* added winmm/mmtimer to list of system libraries - required
for timeGetTime()
* ChangeLog.txt
! typos
2017-04-14 17:17 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/harbour.def
* removed hb_fsPoll() added by mistake - it's only in *nix builds
@@ -18,8 +32,8 @@
* include/hbapifs.h
* src/rtl/filesys.c
+ added new C functions for UNIX and DJGPP builds:
int hb_fsPollFD( PHB_POLLFD pPollSet, int iCount,
HB_MAXINT nTimeOut );
int hb_fsPoll( PHB_POLLFD pPollSet, int iCount,
HB_MAXINT nTimeOut );
int hb_fsCanRead( HB_FHANDLE hFileHandle, HB_MAXINT nTimeOut );
int hb_fsCanWrite( HB_FHANDLE hFileHandle, HB_MAXINT nTimeOut );
These functions should be used instead of select() in C code to hide
@@ -38,7 +52,7 @@
corresponding hb_socket*() and hb_fsPipe*() API but not for all
other cases. This one is for POSIX compilant code which needs pure
POSIX select()/poll() functionality.
Please note that HB_POLLFD structure should is compatible with
Please note that HB_POLLFD structure should be compatible with
struct pollfd defined by POSIX.1-2001 anyhow not all platforms
confirm this standard so portable Harbour code should always use
HB_POLLFD and HB_POLL* constant values instead of POLL* ones.

View File

@@ -30,11 +30,10 @@ ifneq ($(HB_LINKING_RTL),)
ifeq ($(HB_HAS_ZLIB_LOCAL),)
SYSLIBS += z
endif
SYSLIBS += rt
ifneq ($(HB_LINKING_VMMT),)
SYSLIBS += pthread
endif
endif
SYSLIBS += m
SYSLIBS += m rt

View File

@@ -21,11 +21,11 @@ ifneq ($(HB_LINKING_RTL),)
ifeq ($(HB_HAS_ZLIB_LOCAL),)
SYSLIBS += z
endif
SYSLIBS += rt dl
SYSLIBS += dl
# Don't seem to be needed here, but added it for reference to move/copy it to *nix platforms where this is required
ifneq ($(HB_LINKING_VMMT),)
SYSLIBS += pthread
endif
endif
SYSLIBS += m
SYSLIBS += m rt

View File

@@ -22,7 +22,6 @@ ifneq ($(HB_LINKING_RTL),)
ifeq ($(HB_HAS_ZLIB_LOCAL),)
SYSLIBS += z
endif
SYSLIBS += rt
endif
SYSLIBS += m
SYSLIBS += m rt

View File

@@ -29,7 +29,7 @@ ifneq ($(HB_LINKING_RTL),)
ifeq ($(HB_HAS_ZLIB_LOCAL),)
SYSLIBS += z
endif
SYSLIBS += rt dl
SYSLIBS += dl
# Don't seem to be needed here, but added it for reference to move/copy it to *nix platforms where this is required
ifneq ($(HB_LINKING_VMMT),)
SYSLIBS += pthread
@@ -40,4 +40,4 @@ else
endif
endif
SYSLIBS += m
SYSLIBS += m rt

View File

@@ -22,7 +22,7 @@ ifneq ($(HB_LINKING_RTL),)
ifeq ($(HB_HAS_ZLIB_LOCAL),)
SYSLIBS += z
endif
SYSLIBS += rt socket nsl resolv
SYSLIBS += socket nsl resolv
endif
SYSLIBS += m
SYSLIBS += m rt

View File

@@ -9,4 +9,4 @@ HB_CFLAGS += -DUNDER_CE
HB_GT_LIBS += gtwvt gtgui
SYSLIBS += coredll ws2 iphlpapi
SYSLIBS += coredll ws2 iphlpapi winmm

View File

@@ -50,6 +50,8 @@ endif
LD := $(CC)
LD_OUT := -o$(subst x,x, )
SYSLIBS := $(subst winmm,mmtimer,$(SYSLIBS))
LIBPATHS := $(foreach dir,$(LIB_DIR),-L$(dir))
LDLIBS := $(foreach lib,$(HB_USER_LIBS) $(LIBS) $(SYSLIBS),-l$(lib))

View File

@@ -22,4 +22,4 @@ ifneq ($(wildcard $(TOP)$(ROOT)lib/3rd/$(HB_PLATFORM)/$(HB_COMPILER)),)
3RDLIBS := unicows
endif
SYSLIBS += kernel32 user32 ws2_32 iphlpapi advapi32 gdi32
SYSLIBS += kernel32 user32 ws2_32 iphlpapi advapi32 gdi32 winmm

View File

@@ -1118,9 +1118,62 @@ double hb_timeLocalToUTC( double dTimeStamp )
HB_MAXUINT hb_timerGet( void )
{
HB_TRACE( HB_TR_DEBUG, ( "hb_timerInit()" ) );
HB_TRACE( HB_TR_DEBUG, ( "hb_timerGet()" ) );
return hb_dateMilliSeconds();
#if defined( _POSIX_C_SOURCE ) && _POSIX_C_SOURCE >= 199309L && defined( CLOCK_REALTIME )
static int s_iClkId = -1;
struct timespec ts;
if( s_iClkId < 0 )
{
int i, piClkId[] = {
# if defined( CLOCK_MONOTONIC )
CLOCK_MONOTONIC,
# endif
# if defined( CLOCK_MONOTONIC_COARSE )
CLOCK_MONOTONIC_COARSE,
# endif
# if defined( CLOCK_REALTIME )
CLOCK_REALTIME,
# endif
# if defined( CLOCK_REALTIME_COARSE )
CLOCK_REALTIME_COARSE,
# endif
0 };
for( i = 0; i < ( int ) HB_SIZEOFARRAY( piClkId ); ++i )
{
s_iClkId = piClkId[ i ];
if( s_iClkId == 0 || clock_getres( s_iClkId, &ts ) == 0 )
break;
}
}
if( s_iClkId != 0 && clock_gettime( s_iClkId, &ts ) == 0 )
return ( HB_MAXUINT ) ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
#endif
#if defined( HB_OS_UNIX ) || defined( HB_OS_OS2 )
{
struct timeval tv;
gettimeofday( &tv, NULL );
return ( HB_MAXUINT ) tv.tv_sec * 1000 + tv.tv_usec / 1000;
}
#elif defined( HB_OS_WIN )
{
static DWORD s_dwCounter = 0, s_dwLast = 0;
DWORD dwTime = timeGetTime();
if( dwTime < s_dwLast )
++s_dwCounter;
s_dwLast = dwTime;
return ( ( HB_MAXUINT ) s_dwCounter << 32 ) + dwTime;
}
#else
{
struct timeb tb;
ftime( &tb );
return ( HB_MAXUINT ) tb.time * 1000 + tb.millitm;
}
#endif
}
HB_MAXUINT hb_timerInit( HB_MAXINT nTimeOut )

View File

@@ -4453,14 +4453,15 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit
ELSE
AAdd( hbmk[ _HBMK_aOPTL ], "-o{OE}" )
ENDIF
l_aLIBSYS := ArrayAJoin( { l_aLIBSYS, l_aLIBSYSCORE, l_aLIBSYSMISC } )
IF hbmk[ _HBMK_lWINUNI ]
AAdd( hbmk[ _HBMK_aOPTC ], "-DUNICODE" )
ENDIF
IF hbmk[ _HBMK_cPLAT ] == "wce"
AAdd( l_aLIBSYS, "mmtimer" )
AAdd( hbmk[ _HBMK_aOPTC ], "-DUNDER_CE" )
AAdd( hbmk[ _HBMK_aOPTRES ], "-DUNDER_CE" )
ENDIF
l_aLIBSYS := ArrayAJoin( { l_aLIBSYS, l_aLIBSYSCORE, l_aLIBSYSMISC } )
DO CASE
CASE _HBMODE_IS_XHB( hbmk[ _HBMK_nHBMODE ] )
/* NOTE: Newer xhb versions use "-x.y.z" version numbers. */
@@ -5207,6 +5208,7 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit
AAdd( hbmk[ _HBMK_aOPTC ], "-DUNICODE" )
ENDIF
IF hbmk[ _HBMK_cPLAT ] == "wce"
AAdd( l_aLIBSYS, "winmm" )
AAdd( hbmk[ _HBMK_aOPTC ], "-DUNDER_CE" )
AAdd( hbmk[ _HBMK_aOPTRES ], "-DUNDER_CE" )
DO CASE
@@ -5311,6 +5313,7 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit
AAdd( hbmk[ _HBMK_aOPTC ], "-DUNICODE" )
ENDIF
IF hbmk[ _HBMK_cPLAT ] == "wce"
AAdd( l_aLIBSYS, "winmm" )
AAdd( hbmk[ _HBMK_aOPTC ], "-D_WINCE" ) /* Required by pocc Windows headers */
AAdd( hbmk[ _HBMK_aOPTC ], "-DUNDER_CE" )
AAdd( hbmk[ _HBMK_aOPTRES ], "-DUNDER_CE" )