Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Méso-NH code
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Méso-NH
Méso-NH code
Commits
d903a9da
Commit
d903a9da
authored
2 years ago
by
WAUTELET Philippe
Browse files
Options
Downloads
Patches
Plain Diff
Philippe 27/10/2022: datetime: add - operator via DATETIME_TIME_SUBSTRACT subroutine
parent
ce2bd940
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/MNH/mode_datetime.f90
+22
-1
22 additions, 1 deletion
src/MNH/mode_datetime.f90
with
22 additions
and
1 deletion
src/MNH/mode_datetime.f90
+
22
−
1
View file @
d903a9da
...
...
@@ -7,7 +7,7 @@
! P. Wautelet 22/02/2019: use MOD intrinsics with same kind for all arguments (to respect Fortran standard)
! P. Wautelet 19/04/2019: use modd_precision kinds
! P. Wautelet 20/07/2021: modify DATETIME_TIME2REFERENCE and DATETIME_DISTANCE to allow correct computation with 32-bit floats
! P. Wautelet 27/10/2022: add +, <= and > operators and improve older comparison subroutines (more robust but slower)
! P. Wautelet 27/10/2022: add +,
-,
<= and > operators and improve older comparison subroutines (more robust but slower)
!-----------------------------------------------------------------
MODULE
MODE_DATETIME
!
...
...
@@ -25,6 +25,7 @@ PUBLIC :: OPERATOR(<=)
PUBLIC
::
OPERATOR
(
>
)
PUBLIC
::
OPERATOR
(
>=
)
PUBLIC
::
OPERATOR
(
+
)
PUBLIC
::
OPERATOR
(
-
)
!
!Reference date (do not change it)
!To work with DATETIME_TIME2REFERENCE, we assume the year is a multiple of 400 + 1 and the date is January 1st (and time=0.)
...
...
@@ -50,6 +51,10 @@ INTERFACE OPERATOR(+)
MODULE
PROCEDURE
DATETIME_TIME_ADD
END
INTERFACE
!
INTERFACE
OPERATOR
(
-
)
MODULE
PROCEDURE
DATETIME_TIME_SUBSTRACT
END
INTERFACE
!
CONTAINS
!
SUBROUTINE
DATETIME_TIME2REFERENCE
(
TPDATE
,
KDAYS
,
PSEC
)
...
...
@@ -405,4 +410,20 @@ CALL DATETIME_CORRECTDATE( TPOUT )
END
FUNCTION
DATETIME_TIME_ADD
FUNCTION
DATETIME_TIME_SUBSTRACT
(
TPT1
,
TPT2
)
RESULT
(
PDIST
)
!
!Compute distance (in seconds) between 2 dates
!
IMPLICIT
NONE
TYPE
(
DATE_TIME
),
INTENT
(
IN
)
::
TPT1
TYPE
(
DATE_TIME
),
INTENT
(
IN
)
::
TPT2
REAL
::
PDIST
CALL
DATETIME_DISTANCE
(
TPT2
,
TPT1
,
PDIST
)
END
FUNCTION
DATETIME_TIME_SUBSTRACT
END
MODULE
MODE_DATETIME
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment