2016-12-15 12:51 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* include/harbour.hbx
* src/harbour.def
* src/rtl/dateshb.c
+ added new PRG functions which convert time difference to hours,
minutes, seconds and milliseconds. Except milliseconds the results
are floating point numbers with fractional part representing the
rest of conversion:
hb_NToHour( <nTimeDiff> ) => <nHours>
hb_NToMin ( <nTimeDiff> ) => <nMinutes>
hb_NToSec ( <nTimeDiff> ) => <nSeconds>
hb_NToMSec( <nTimeDiff> ) => <nMilliseconds>
+ added new PRG functions which convert timestamp value to hours,
minutes, seconds and milliseconds. Except milliseconds the results
are floating point numbers with fractional part representing the
rest of conversion:
hb_TToHour( <tTimeStamp> ) => <nHours>
hb_TToMin ( <tTimeStamp> ) => <nMinutes>
hb_TToSec ( <tTimeStamp> ) => <nSeconds>
hb_TToMSec( <tTimeStamp> ) => <nMilliseconds>
* src/rtl/gtsln/gtsln.c
! fixed cleanup string sent to terminal to remove test UTF-8 character
* src/rtl/gtsln/kbsln.c
+ added workaround for some broken Linux kernel which wrongly sets
tty device as ready for reading
* src/rtl/hbsocket.c
* added comment
* src/rdd/dbfnsx/dbfnsx1.c
* src/rdd/dbfntx/dbfntx1.c
! added missing tag root page restoring cleared after discarding buffers
due to concurrent access to multitag indexes.
Many thanks for Karsten Stucker for self contain example.
* src/rdd/dbfntx/dbfntx1.c
* discard buffers when next free page is changed even without touching
version number - minor protection for potentially broken 3-rd party
NTX code or very old [x]Harbour NTX RDDs which do not increment
version number on update.
This commit is contained in:
@@ -10,6 +10,49 @@
|
||||
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
|
||||
*/
|
||||
|
||||
2016-12-15 12:51 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* include/harbour.hbx
|
||||
* src/harbour.def
|
||||
* src/rtl/dateshb.c
|
||||
+ added new PRG functions which convert time difference to hours,
|
||||
minutes, seconds and milliseconds. Except milliseconds the results
|
||||
are floating point numbers with fractional part representing the
|
||||
rest of conversion:
|
||||
hb_NToHour( <nTimeDiff> ) => <nHours>
|
||||
hb_NToMin ( <nTimeDiff> ) => <nMinutes>
|
||||
hb_NToSec ( <nTimeDiff> ) => <nSeconds>
|
||||
hb_NToMSec( <nTimeDiff> ) => <nMilliseconds>
|
||||
+ added new PRG functions which convert timestamp value to hours,
|
||||
minutes, seconds and milliseconds. Except milliseconds the results
|
||||
are floating point numbers with fractional part representing the
|
||||
rest of conversion:
|
||||
hb_TToHour( <tTimeStamp> ) => <nHours>
|
||||
hb_TToMin ( <tTimeStamp> ) => <nMinutes>
|
||||
hb_TToSec ( <tTimeStamp> ) => <nSeconds>
|
||||
hb_TToMSec( <tTimeStamp> ) => <nMilliseconds>
|
||||
|
||||
* src/rtl/gtsln/gtsln.c
|
||||
! fixed cleanup string sent to terminal to remove test UTF-8 character
|
||||
|
||||
* src/rtl/gtsln/kbsln.c
|
||||
+ added workaround for some broken Linux kernel which wrongly sets
|
||||
tty device as ready for reading
|
||||
|
||||
* src/rtl/hbsocket.c
|
||||
* added comment
|
||||
|
||||
* src/rdd/dbfnsx/dbfnsx1.c
|
||||
* src/rdd/dbfntx/dbfntx1.c
|
||||
! added missing tag root page restoring cleared after discarding buffers
|
||||
due to concurrent access to multitag indexes.
|
||||
Many thanks for Karsten Stucker for self contain example.
|
||||
|
||||
* src/rdd/dbfntx/dbfntx1.c
|
||||
* discard buffers when next free page is changed even without touching
|
||||
version number - minor protection for potentially broken 3-rd party
|
||||
NTX code or very old [x]Harbour NTX RDDs which do not increment
|
||||
version number on update.
|
||||
|
||||
2016-11-16 16:10 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* contrib/hbssl/hbssl.h
|
||||
* contrib/hbssl/evppkey.c
|
||||
|
||||
@@ -711,7 +711,11 @@ DYNAMIC hb_mvRestore
|
||||
DYNAMIC hb_mvSave
|
||||
DYNAMIC hb_ntoc
|
||||
DYNAMIC hb_NToColor
|
||||
DYNAMIC hb_NToHour
|
||||
DYNAMIC hb_NToMin
|
||||
DYNAMIC hb_NToMSec
|
||||
DYNAMIC hb_ntos
|
||||
DYNAMIC hb_NToSec
|
||||
DYNAMIC hb_NToT
|
||||
DYNAMIC hb_NumToHex
|
||||
DYNAMIC hb_OEMToANSI
|
||||
@@ -880,8 +884,12 @@ DYNAMIC hb_TSToStr
|
||||
DYNAMIC hb_TSToUTC
|
||||
DYNAMIC hb_TToC
|
||||
DYNAMIC hb_TToD
|
||||
DYNAMIC hb_TToHour
|
||||
DYNAMIC hb_TToMin
|
||||
DYNAMIC hb_TToMSec
|
||||
DYNAMIC hb_TToN
|
||||
DYNAMIC hb_TToS
|
||||
DYNAMIC hb_TToSec
|
||||
DYNAMIC hb_UAt
|
||||
DYNAMIC hb_UChar
|
||||
DYNAMIC hb_UCode
|
||||
|
||||
@@ -896,7 +896,11 @@ HB_FUN_HB_MUTEXUNLOCK
|
||||
HB_FUN_HB_MVRESTORE
|
||||
HB_FUN_HB_MVSAVE
|
||||
HB_FUN_HB_NTOCOLOR
|
||||
HB_FUN_HB_NTOHOUR
|
||||
HB_FUN_HB_NTOMIN
|
||||
HB_FUN_HB_NTOMSEC
|
||||
HB_FUN_HB_NTOS
|
||||
HB_FUN_HB_NTOSEC
|
||||
HB_FUN_HB_NTOT
|
||||
HB_FUN_HB_NUMTOHEX
|
||||
HB_FUN_HB_OEMTOANSI
|
||||
@@ -1065,8 +1069,12 @@ HB_FUN_HB_TSTOSTR
|
||||
HB_FUN_HB_TSTOUTC
|
||||
HB_FUN_HB_TTOC
|
||||
HB_FUN_HB_TTOD
|
||||
HB_FUN_HB_TTOHOUR
|
||||
HB_FUN_HB_TTOMIN
|
||||
HB_FUN_HB_TTOMSEC
|
||||
HB_FUN_HB_TTON
|
||||
HB_FUN_HB_TTOS
|
||||
HB_FUN_HB_TTOSEC
|
||||
HB_FUN_HB_UAT
|
||||
HB_FUN_HB_UCHAR
|
||||
HB_FUN_HB_UCODE
|
||||
|
||||
@@ -1443,14 +1443,10 @@ static LPPAGEINFO hb_nsxPageGetBuffer( LPTAGINFO pTag, HB_ULONG ulPage )
|
||||
}
|
||||
|
||||
if( ! *pPagePtr )
|
||||
{
|
||||
*pPagePtr = ( LPPAGEINFO ) hb_xgrabz( sizeof( HB_PAGEINFO ) );
|
||||
}
|
||||
#ifdef HB_NSX_EXTERNAL_PAGEBUFFER
|
||||
if( ! hb_nsxPageBuffer( *pPagePtr ) )
|
||||
{
|
||||
hb_nsxPageBuffer( *pPagePtr ) = ( HB_UCHAR * ) hb_xgrabz( NSX_PAGELEN );
|
||||
}
|
||||
#endif
|
||||
( *pPagePtr )->pPrev = NULL;
|
||||
( *pPagePtr )->Page = ulPage;
|
||||
@@ -6443,9 +6439,9 @@ static HB_ERRCODE hb_nsxGoCold( NSXAREAP pArea )
|
||||
break;
|
||||
}
|
||||
fLck = HB_TRUE;
|
||||
if( ! pTag->HeadBlock || ! pTag->RootBlock )
|
||||
fAdd = fDel = HB_FALSE;
|
||||
}
|
||||
if( ! pTag->HeadBlock || ! hb_nsxTagHeaderCheck( pTag ) )
|
||||
fAdd = fDel = HB_FALSE;
|
||||
if( fDel )
|
||||
{
|
||||
if( hb_nsxTagKeyDel( pTag, pTag->HotKeyInfo ) )
|
||||
@@ -6973,7 +6969,7 @@ static HB_ERRCODE hb_nsxOrderCreate( NSXAREAP pArea, LPDBORDERCREATEINFO pOrderI
|
||||
if( iTag )
|
||||
{
|
||||
pTag->HeadBlock = pIndex->lpTags[ iTag - 1 ]->HeadBlock;
|
||||
if( pIndex->lpTags[ iTag - 1 ]->RootBlock &&
|
||||
if( hb_nsxTagHeaderCheck( pIndex->lpTags[ iTag - 1 ] ) &&
|
||||
! hb_nsxTagPagesFree( pIndex->lpTags[ iTag - 1 ],
|
||||
pIndex->lpTags[ iTag - 1 ]->RootBlock ) )
|
||||
{
|
||||
|
||||
@@ -1967,7 +1967,7 @@ static HB_ERRCODE hb_ntxIndexHeaderRead( LPNTXINDEX pIndex )
|
||||
else
|
||||
{
|
||||
LPNTXHEADER lpNTX = ( LPNTXHEADER ) pIndex->HeaderBuff;
|
||||
HB_ULONG ulRootPage, ulVersion;
|
||||
HB_ULONG ulRootPage, ulVersion, ulNext;
|
||||
LPTAGINFO pTag;
|
||||
|
||||
if( pIndex->Compound )
|
||||
@@ -1980,12 +1980,13 @@ static HB_ERRCODE hb_ntxIndexHeaderRead( LPNTXINDEX pIndex )
|
||||
|
||||
ulVersion = HB_GET_LE_UINT16( lpNTX->version );
|
||||
ulRootPage = HB_GET_LE_UINT32( lpNTX->root );
|
||||
pIndex->NextAvail = HB_GET_LE_UINT32( lpNTX->next_page );
|
||||
if( pIndex->Version != ulVersion || ( pTag &&
|
||||
( pTag->Signature != type || ulRootPage != pTag->RootBlock ) ) )
|
||||
ulNext = HB_GET_LE_UINT32( lpNTX->next_page );
|
||||
if( pIndex->Version != ulVersion || pIndex->NextAvail != ulNext ||
|
||||
( pTag && ( pTag->Signature != type || ulRootPage != pTag->RootBlock ) ) )
|
||||
{
|
||||
hb_ntxDiscardBuffers( pIndex );
|
||||
pIndex->Version = ulVersion;
|
||||
pIndex->NextAvail = ulNext;
|
||||
if( pTag )
|
||||
{
|
||||
pTag->RootBlock = ulRootPage;
|
||||
@@ -5983,10 +5984,10 @@ static HB_ERRCODE hb_ntxGoCold( NTXAREAP pArea )
|
||||
break;
|
||||
}
|
||||
fLck = HB_TRUE;
|
||||
if( ( pTag->pIndex->Compound && ! pTag->HeadBlock ) ||
|
||||
! pTag->RootBlock )
|
||||
fAdd = fDel = HB_FALSE;
|
||||
}
|
||||
if( ( pTag->pIndex->Compound && ! pTag->HeadBlock ) ||
|
||||
! hb_ntxTagHeaderCheck( pTag ) )
|
||||
fAdd = fDel = HB_FALSE;
|
||||
if( fDel )
|
||||
{
|
||||
if( hb_ntxTagKeyDel( pTag, pTag->HotKeyInfo ) )
|
||||
@@ -6595,7 +6596,7 @@ static HB_ERRCODE hb_ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderI
|
||||
if( iTag )
|
||||
{
|
||||
pTag->HeadBlock = pIndex->lpTags[ iTag - 1 ]->HeadBlock;
|
||||
if( pIndex->lpTags[ iTag - 1 ]->RootBlock &&
|
||||
if( hb_ntxTagHeaderCheck( pIndex->lpTags[ iTag - 1 ] ) &&
|
||||
! hb_ntxTagPagesFree( pIndex->lpTags[ iTag - 1 ],
|
||||
pIndex->lpTags[ iTag - 1 ]->RootBlock ) )
|
||||
{
|
||||
|
||||
@@ -289,6 +289,16 @@ HB_FUNC( HB_TTOD )
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
}
|
||||
|
||||
HB_FUNC( HB_TTON )
|
||||
{
|
||||
PHB_ITEM pTime = hb_param( 1, HB_IT_DATETIME );
|
||||
|
||||
if( pTime )
|
||||
hb_retnd( hb_itemGetTD( pTime ) );
|
||||
else
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
}
|
||||
|
||||
HB_FUNC( HB_NTOT )
|
||||
{
|
||||
PHB_ITEM pNum = hb_param( 1, HB_IT_NUMERIC );
|
||||
@@ -299,12 +309,52 @@ HB_FUNC( HB_NTOT )
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
}
|
||||
|
||||
HB_FUNC( HB_TTON )
|
||||
HB_FUNC( HB_NTOMSEC )
|
||||
{
|
||||
PHB_ITEM pTime = hb_param( 1, HB_IT_DATETIME );
|
||||
PHB_ITEM pNum = hb_param( 1, HB_IT_NUMERIC );
|
||||
|
||||
if( pTime )
|
||||
hb_retnd( hb_itemGetTD( pTime ) );
|
||||
if( pNum )
|
||||
hb_retnint( ( HB_MAXINT ) ( hb_itemGetND( pNum ) * HB_MILLISECS_PER_DAY ) );
|
||||
else
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
}
|
||||
|
||||
HB_FUNC( HB_NTOSEC )
|
||||
{
|
||||
PHB_ITEM pNum = hb_param( 1, HB_IT_NUMERIC );
|
||||
|
||||
if( pNum )
|
||||
hb_retnd( hb_itemGetND( pNum ) * HB_SECONDS_PER_DAY );
|
||||
else
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
}
|
||||
|
||||
HB_FUNC( HB_NTOMIN )
|
||||
{
|
||||
PHB_ITEM pNum = hb_param( 1, HB_IT_NUMERIC );
|
||||
|
||||
if( pNum )
|
||||
hb_retnd( hb_itemGetND( pNum ) * HB_MINUTES_PER_DAY );
|
||||
else
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
}
|
||||
|
||||
HB_FUNC( HB_NTOHOUR )
|
||||
{
|
||||
PHB_ITEM pNum = hb_param( 1, HB_IT_NUMERIC );
|
||||
|
||||
if( pNum )
|
||||
hb_retnd( hb_itemGetND( pNum ) * 24 );
|
||||
else
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
}
|
||||
|
||||
HB_FUNC( HB_TTOSEC )
|
||||
{
|
||||
long lDate, lTime;
|
||||
|
||||
if( hb_partdt( &lDate, &lTime, 1 ) )
|
||||
hb_retnd( ( double ) lDate * HB_SECONDS_PER_DAY + ( double ) lTime / 1000 );
|
||||
else
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
}
|
||||
@@ -329,6 +379,36 @@ HB_FUNC( HB_MSECTOT )
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
}
|
||||
|
||||
HB_FUNC( HB_TTOMSEC )
|
||||
{
|
||||
long lDate, lTime;
|
||||
|
||||
if( hb_partdt( &lDate, &lTime, 1 ) )
|
||||
hb_retnd( ( double ) lDate * HB_MILLISECS_PER_DAY + lTime );
|
||||
else
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
}
|
||||
|
||||
HB_FUNC( HB_TTOMIN )
|
||||
{
|
||||
long lDate, lTime;
|
||||
|
||||
if( hb_partdt( &lDate, &lTime, 1 ) )
|
||||
hb_retnd( ( double ) lDate * HB_MINUTES_PER_DAY + ( double ) lTime / ( 60 * 1000 ) );
|
||||
else
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
}
|
||||
|
||||
HB_FUNC( HB_TTOHOUR )
|
||||
{
|
||||
long lDate, lTime;
|
||||
|
||||
if( hb_partdt( &lDate, &lTime, 1 ) )
|
||||
hb_retnd( ( double ) lDate * 24 + ( double ) lTime / ( 60 * 60 * 1000 ) );
|
||||
else
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
}
|
||||
|
||||
HB_FUNC( HB_TTOC )
|
||||
{
|
||||
long lDate, lTime;
|
||||
|
||||
@@ -479,7 +479,7 @@ static int hb_sln_isUTF8( int iStdOut, int iStdIn )
|
||||
{
|
||||
if( isatty( iStdOut ) && isatty( iStdIn ) )
|
||||
{
|
||||
const char * szBuf = "\r\303\255\033[6n \r";
|
||||
const char * szBuf = "\r\303\255\033[6n\r \r";
|
||||
int len = strlen( szBuf );
|
||||
|
||||
if( write( iStdOut, szBuf, len ) == len )
|
||||
|
||||
@@ -266,6 +266,11 @@ int hb_sln_Init_Terminal( int phase )
|
||||
/* already done in Slang library */
|
||||
/* newTTY.c_cc[ VDSUSP ] = 255; */ /* disable ^Y delayed suspend processing */
|
||||
|
||||
/* workaround for bug in some Linux kernels (i.e. 3.13.0-64-generic
|
||||
Ubuntu) in which select() unconditionally accepts stdin for
|
||||
reading if c_cc[ VMIN ] = 0 [druzus] */
|
||||
newTTY.c_cc[ VMIN ] = 1;
|
||||
|
||||
if( tcsetattr( SLang_TT_Read_FD, TCSADRAIN, &newTTY ) == 0 )
|
||||
/* everything looks ok so far */
|
||||
ret = 1;
|
||||
|
||||
@@ -130,6 +130,8 @@
|
||||
# define HB_HAS_GETHOSTBYADDR
|
||||
# if ! defined( HB_HAS_POLL ) && ! defined( HB_NO_POLL ) && \
|
||||
defined( _POSIX_C_SOURCE ) && _POSIX_C_SOURCE >= 200112L
|
||||
/* use poll() instead of select() to avoid FD_SETSIZE (1024 in Linux)
|
||||
file handle limit */
|
||||
# define HB_HAS_POLL
|
||||
# endif
|
||||
# endif
|
||||
|
||||
Reference in New Issue
Block a user