Skip to content

Commit

Permalink
Modify setFromInfo y token to match POSIX
Browse files Browse the repository at this point in the history
  • Loading branch information
jmk0 committed Oct 26, 2015
1 parent be557f3 commit 1647518
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions core/lib/TimeHandling/CivilTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,22 +193,20 @@ namespace gpstk
break;

case 'y':
switch( i->second.length() )
{
case 2:
year = asInt( i->second ) + 1900;
if( year < 1980 )
year += 100;
break;
case 3:
year = asInt( i->second ) + 1000;
if( year < 1980 )
year += 100;
break;
default:
year = asInt( i->second );
break;
};
// match the POSIX strptime() function:
/* Year within century. When a century is not
* otherwise specified, values in the range 69-99
* refer to years in the twentieth century (1969 to
* 1999 inclusive); values in the range 00-68 refer
* to years in the twenty-first century (2000 to
* 2068 inclusive). */
if( i->second.length() > 2)
return false;
year = asInt( i->second );
if (year >= 69)
year += 1900;
else
year += 2000;
break;

case 'm':
Expand Down

0 comments on commit 1647518

Please sign in to comment.