Commit 4a0545d3 authored by Graham, Aaron's avatar Graham, Aaron
Browse files

Merge branch 'hotfix_times' into 'master'

Fix issue with getDate

See merge request futility/Futility!371
parents 75911d92 ec44cb25
Pipeline #218096 passed with stage
in 2 minutes and 10 seconds
......@@ -288,7 +288,7 @@ FUNCTION getDate(opt) RESULT(strdate)
mon=(/'Jan.','Feb.','Mar.','Apr.','May ','June', &
'July','Aug.','Sep.','Oct.','Nov.','Dec.'/)
INTEGER(SIK),OPTIONAL,INTENT(IN) :: opt
CHARACTER(LEN=13) :: strdate
TYPE(StringType) :: strdate
CHARACTER(LEN=8) :: adate
CHARACTER(LEN=4) :: yy
CHARACTER(LEN=2) :: dd,mm
......@@ -305,11 +305,11 @@ FUNCTION getDate(opt) RESULT(strdate)
yy=adate(1:4)
mm=adate(5:6)
dd=adate(7:8)
READ(mm,'(i2)') imon
IF(fmt == 1_SIK .AND. LEN(strdate) >= 8_SIK) THEN
IF(fmt == 1_SIK) THEN
strdate=mm//'/'//dd//'/'//yy
ELSEIF(fmt == 2_SIK .AND. LEN(strdate) >= 13_SIK) THEN
strdate=mon(imon)//' '//dd//', '//yy
ELSEIF(fmt == 2_SIK) THEN
READ(mm,'(i2)') imon
strdate=TRIM(mon(imon))//' '//dd//', '//yy
ENDIF
ENDFUNCTION getDate
!
......
......@@ -20,7 +20,7 @@ INTEGER :: idum1,idum2,idum3,ioerr
CHARACTER(LEN=1) :: adum1,adum2
CHARACTER(LEN=5) :: adum3
CHARACTER(LEN=2) :: adum4
TYPE(StringType) :: adate
TYPE(StringType) :: adate,adate2
TYPE(StringType) :: aclock
REAL(SRK) :: totalElapsed
!
......@@ -56,8 +56,8 @@ SUBROUTINE testTimers()
ASSERT_GT(idum2,0,'day')
ASSERT_LT(idum2,32,'day')
ASSERT_GT(idum3,0,'year')
INFO(0) 'getDate() = '//getDate()
ASSERT_EQ(getDate(),getDate(1),'getDate(1)')
adate2=getDate(1)
ASSERT_EQ(CHAR(adate),CHAR(adate2),'getDate(1)')
idum1=0
idum2=0
......@@ -68,7 +68,12 @@ SUBROUTINE testTimers()
ASSERT_GT(idum1,0,'day')
ASSERT_LT(idum1,32,'day')
ASSERT_GT(idum2,0,'year')
ASSERT_EQ(tokens(1)%substr(LEN(tokens(1))),'.','month')
SELECTCASE(CHAR(tokens(1)))
CASE('Jan.','Feb.','Mar.','Apr.','May','June','July','Aug.','Sep.','Oct.','Nov.','Dec.')
ASSERT(.TRUE.,'month')
CASE DEFAULT
ASSERT(.FALSE.,'month = "'//tokens(1)//'"')
ENDSELECT
!Test getTimeFromDate
COMPONENT_TEST('getTimeFromDate')
......@@ -172,7 +177,7 @@ SUBROUTINE testTimers()
ASSERT_GT(idum2,0,'day')
ASSERT_LT(idum2,32,'day')
ASSERT_GT(idum3,0,'year')
ASSERT_EQ(testTimer%getDate(),testTimer%getDate(1),'%getDate(1)')
ASSERT_EQ(CHAR(testTimer%getDate()),CHAR(testTimer%getDate(1)),'%getDate(1)')
idum1=0
idum2=0
tokens=adate%split('/')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment