Skip to content

Commit

Permalink
2023-11-11 13:33 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
Browse files Browse the repository at this point in the history
  * src/common/hbdate.c
    * accept timestamp values with trailing "Z" indicating UTC time
      (zero hour offset)
  • Loading branch information
druzus committed Nov 11, 2023
1 parent deda6c7 commit d12558f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
5 changes: 5 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
Entries may not always be in chronological/commit order.
See license at the end of file. */

2023-11-11 13:33 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/common/hbdate.c
* accept timestamp values with trailing "Z" indicating UTC time
(zero hour offset)

2023-11-09 15:07 UTC+0100 Phil Krylov (phil a t krylov.eu)
* .github/workflows/linux-ci.yml
* .github/workflows/macos-ci.yml
Expand Down
43 changes: 24 additions & 19 deletions src/common/hbdate.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,27 +545,32 @@ HB_BOOL hb_timeStrGet( const char * szTime,
}
}
}
while( HB_ISSPACE( *szTime ) )
if( iBlocks > 0 && ( szTime[ 0 ] == 'Z' || szTime[ 0 ] == 'z' ) )
++szTime;
if( ( szTime[ 0 ] == 'p' || szTime[ 0 ] == 'P' ) &&
( szTime[ 1 ] == 'm' || szTime[ 1 ] == 'M' ) )
{
++iBlocks;
szTime += 2;
if( iHour == 0 )
iHour = 24; /* wrong time */
else if( iHour != 12 )
iHour += 12;
}
else if( ( szTime[ 0 ] == 'a' || szTime[ 0 ] == 'A' ) &&
( szTime[ 1 ] == 'm' || szTime[ 1 ] == 'M' ) )
else
{
++iBlocks;
szTime += 2;
if( iHour == 0 )
iHour = 24; /* wrong time */
else if( iHour == 12 )
iHour = 0;
while( HB_ISSPACE( *szTime ) )
++szTime;
if( ( szTime[ 0 ] == 'p' || szTime[ 0 ] == 'P' ) &&
( szTime[ 1 ] == 'm' || szTime[ 1 ] == 'M' ) )
{
++iBlocks;
szTime += 2;
if( iHour == 0 )
iHour = 24; /* wrong time */
else if( iHour != 12 )
iHour += 12;
}
else if( ( szTime[ 0 ] == 'a' || szTime[ 0 ] == 'A' ) &&
( szTime[ 1 ] == 'm' || szTime[ 1 ] == 'M' ) )
{
++iBlocks;
szTime += 2;
if( iHour == 0 )
iHour = 24; /* wrong time */
else if( iHour == 12 )
iHour = 0;
}
}
while( HB_ISSPACE( *szTime ) )
++szTime;
Expand Down

0 comments on commit d12558f

Please sign in to comment.