mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 07:00:17 -05:00
#14111 Preserve time-of-day in exported DATES keyword
The Event Timeline stores event timestamps with full time-of-day precision, but the exported SCHEDULE deck only emitted DAY/MONTH/YEAR in the DATES keyword, dropping any sub-day precision the user had set. Emit the optional TIME field (HH:MM:SS[.SSS]) in datesKeyword() whenever the timestamp is non-midnight, formatting with millisecond precision when present. Date-only events keep their previous DAY/MONTH/YEAR-only output. The first-date comment in the schedule generator mirrors the same time so it stays consistent with the keyword.
This commit is contained in:
1 parent
8b65c313f8
commit
cbae501a13
4 files changed
+78
-2
No files matched your search
@@ -172,8 +172,17 @@ QString RicScheduleDataGenerator::generateDateSection( const RimWellEventTimelin
|
||||
if ( dateAsComment )
|
||||
{
|
||||
QLocale locale( QLocale::English );
|
||||
QString month = locale.monthName( date.date().month(), QLocale::ShortFormat ).toUpper();
|
||||
result += QString( "-- Date: %1 %2 %3\n" ).arg( date.date().day() ).arg( month ).arg( date.date().year() );
|
||||
QString month = locale.monthName( date.date().month(), QLocale::ShortFormat ).toUpper();
|
||||
QString dateStr = QString( "-- Date: %1 %2 %3" ).arg( date.date().day() ).arg( month ).arg( date.date().year() );
|
||||
|
||||
// Mirror the TIME field emitted in DATES keywords (see RimKeywordFactory::datesKeyword): include the
|
||||
// time-of-day in the comment only when the timestamp is not at midnight.
|
||||
const QTime time = date.time();
|
||||
if ( time.isValid() && ( time.hour() != 0 || time.minute() != 0 || time.second() != 0 || time.msec() != 0 ) )
|
||||
{
|
||||
dateStr += ( time.msec() != 0 ) ? time.toString( " HH:mm:ss.zzz" ) : time.toString( " HH:mm:ss" );
|
||||
}
|
||||
result += dateStr + "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user