2009-04-21 11:56 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/common/hbdate.c
    ! fixed decoding fractional part of seconds in timestamp expressions
      when less the 3 digits were used.

  * harbour/source/rtl/dateshb.c
    + added optional logical parameter to hb_TSToStr() function to enabled
      packed/stripped form

  * harbour/source/rtl/valtoexp.prg
    % use hb_TSToStr() with new pack parameter in hb_ValToExp() and hb_CStr()
This commit is contained in:
Przemyslaw Czerpak
2009-04-21 09:49:02 +00:00
parent 8d3b5783d5
commit 1e5b62defa
4 changed files with 50 additions and 6 deletions

View File

@@ -8,6 +8,18 @@
2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2009-04-21 11:56 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/common/hbdate.c
! fixed decoding fractional part of seconds in timestamp expressions
when less the 3 digits were used.
* harbour/source/rtl/dateshb.c
+ added optional logical parameter to hb_TSToStr() function to enabled
packed/stripped form
* harbour/source/rtl/valtoexp.prg
% use hb_TSToStr() with new pack parameter in hb_ValToExp() and hb_CStr()
2009-04-21 04:19 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* utils/hbmk2/hbmk2.prg
! Fixed minor but fatal oversight in prev commit.

View File

@@ -510,12 +510,12 @@ BOOL hb_timeStrGet( const char * szTime,
{
++iBlocks;
++szTime;
iMSec = ( *szTime++ - '0' );
iMSec = ( *szTime++ - '0' ) * 100;
if( HB_ISDIGIT( *szTime ) )
{
iMSec = iMSec * 10 + ( *szTime++ - '0' );
iMSec += ( *szTime++ - '0' ) * 10;
if( HB_ISDIGIT( *szTime ) )
iMSec = iMSec * 10 + ( *szTime++ - '0' );
iMSec += ( *szTime++ - '0' );
}
if( HB_ISDIGIT( *szTime ) )
++szTime;

View File

@@ -375,7 +375,39 @@ HB_FUNC( HB_TSTOSTR )
{
char szBuffer[ 24 ];
hb_retc( hb_timeStampStr( szBuffer, lDate, lTime ) );
hb_timeStampStr( szBuffer, lDate, lTime );
if( ISLOG( 2 ) && hb_parl( 2 ) )
{
if( lTime == 0 )
{
if( lDate == 0 )
hb_retc( "00:00" );
else
{
szBuffer[ 10 ] = '\0';
hb_retc( szBuffer );
}
}
else
{
int i = 23;
while( szBuffer[ i - 1 ] == '0' )
--i;
if( szBuffer[ i - 1 ] == '.' )
{
--i;
if( szBuffer[ i - 1 ] == '0' && szBuffer[ i - 2 ] == '0' )
i -= 3;
}
szBuffer[ i ] = '\0';
if( lDate == 0 )
hb_retc( szBuffer + 11 );
else
hb_retc( szBuffer );
}
}
else
hb_retc( szBuffer );
}
else
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );

View File

@@ -66,7 +66,7 @@ FUNCTION hb_VALTOEXP( xVal )
cVal := iif( Empty( xVal ), "0d00000000", "0d" + DToS( xVal ) )
EXIT
CASE "T"
cVal := iif( Empty( xVal ), 't"00:00"', 't"' + hb_TSToStr( xVal ) + '"' )
cVal := 't"' + hb_TSToStr( xVal, .T. ) + '"'
EXIT
CASE "L"
cVal := iif( xVal, ".T.", ".F." )
@@ -128,7 +128,7 @@ FUNCTION hb_CStr( xVal )
CASE "D"
RETURN iif( Empty( xVal ), "0d00000000", "0d" + DToS( xVal ) )
CASE "T"
RETURN iif( Empty( xVal ), 't"00:00"', 't"' + hb_TSToStr( xVal ) + '"' )
cVal := 't"' + hb_TSToStr( xVal, .T. ) + '"'
CASE "L"
RETURN iif( xVal, ".T.", ".F." )
CASE "S"