Skip to content

Commit

Permalink
Merge branch 'develop' into feature/custom_acceleration_partials
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicDirkx committed Oct 30, 2023
2 parents 277e67b + 8ee2b8d commit 69a70dc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.12.1.dev38
current_version = 2.12.1.dev39
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<dev>\d+))?
Expand Down
17 changes: 12 additions & 5 deletions include/tudat/astro/basic_astro/dateTime.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ struct DateTime
verifySeconds( );
}

std::string isoString( const bool addT = false )
std::string isoString( const bool addT = false,
const int numberOfFractionalSecondDigits = 15 )
{

std::string yearString = std::to_string( year_ );
Expand All @@ -135,7 +136,7 @@ struct DateTime
std::string secondString = utilities::paddedZeroIntString( static_cast< int >( seconds_ ), 2 );
long double fractionalSeconds = seconds_ - mathematical_constants::getFloatingInteger<long double>(
static_cast< int >( seconds_ ));
std::string fractionalSecondString = utilities::to_string_with_precision< long double >( fractionalSeconds, 17 );
std::string fractionalSecondString = utilities::to_string_with_precision< long double >( fractionalSeconds, numberOfFractionalSecondDigits );

secondString += fractionalSecondString.substr( 1, fractionalSecondString.length( ) - 1 );
std::string separationCharacter = addT ? "T" : " ";
Expand Down Expand Up @@ -219,7 +220,9 @@ struct DateTime
if ( seconds_ > 60.0L || seconds_ < 0.0L || ( seconds_ != seconds_ ))
{
throw std::runtime_error(
"Error when creating Tudat DateTime, input seconds was " + std::to_string( seconds_ ));
"Error when creating Tudat DateTime, input seconds was " + std::to_string( seconds_ ) +
", full date time was " + std::to_string( year_ ) + ", " + std::to_string( month_ ) + ", " + std::to_string( day_ ) + ", " +
std::to_string( hour_ ) + ", " + std::to_string( minute_ ) + ", " + std::to_string( seconds_ ) );
}
}
};
Expand Down Expand Up @@ -261,11 +264,15 @@ DateTime addSecondsToDateTime( const DateTime& dateTime, const TimeType timeToAd
}

template< typename TimeType >
DateTime subtractSecondsFromDateTime( const DateTime& dateTime, const TimeType timeToSubtract )
DateTime addDaysToDateTime( const DateTime& dateTime, const TimeType daysToAdd )
{
return getCalendarDateFromTime< Time >( dateTime.epoch< Time >( ) - timeToSubtract );
return getCalendarDateFromTime< Time >( dateTime.epoch< Time >( ) + daysToAdd * mathematical_constants::getFloatingInteger< TimeType >( 86400 ) );
}





template< typename TimeType >
TimeType getTimeDifferenceBetweenDateTimes( const DateTime& firstDateTime, const DateTime& secondDateTime )
{
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.12.1.dev38
2.12.1.dev39

0 comments on commit 69a70dc

Please sign in to comment.