Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libmtime
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
icon-libraries
libmtime
Commits
f720f80c
Commit
f720f80c
authored
6 years ago
by
Jan Frederik Engels
Browse files
Options
Downloads
Patches
Plain Diff
Add min and max to limtime_hl.f9000
parent
c85ff756
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/example_hl.f90
+8
-3
8 additions, 3 deletions
examples/example_hl.f90
src/libmtime_hl.f90
+35
-0
35 additions, 0 deletions
src/libmtime_hl.f90
with
43 additions
and
3 deletions
examples/example_hl.f90
+
8
−
3
View file @
f720f80c
...
...
@@ -26,12 +26,11 @@ PROGRAM example
USE
mo_example
USE
mtime
,
ONLY
:
setCalendar
,
PROLEPTIC_GREGORIAN
USE
mtime_hl
,
ONLY
:
t_datetime
,
t_timedelta
USE
error_handling
USE
mtime_hl
,
ONLY
:
t_datetime
,
t_timedelta
,
min
,
max
IMPLICIT
NONE
TYPE
(
t_datetime
)
::
dt
,
dt2
,
dt3
TYPE
(
t_datetime
)
::
dt
,
dt2
,
dt3
,
dt4
TYPE
(
t_timedelta
)
::
td
INTEGER
::
test_number1
,
test_number2
,
test_result
...
...
@@ -86,6 +85,12 @@ PROGRAM example
dt3
=
t_datetime
(
"1970-01-01T00:00:01"
)
WRITE
(
0
,
*
)
dt
%
to_string
(),
" == "
,
dt3
%
to_string
(),
": "
,
(
dt
==
dt3
)
! min / max
dt4
=
min
(
dt2
,
dt3
)
WRITE
(
0
,
*
)
"MIN("
,
dt2
%
to_string
(),
", "
,
dt3
%
to_string
(),
"): "
,
dt4
%
to_string
()
dt4
=
max
(
dt2
,
dt3
)
WRITE
(
0
,
*
)
"MAX("
,
dt2
%
to_string
(),
", "
,
dt3
%
to_string
(),
"): "
,
dt4
%
to_string
()
! interval assignment with milliseconds
td
=
t_timedelta
(
360000
)
WRITE
(
0
,
*
)
"interval assignment with milliseconds: "
,
td
%
to_string
()
...
...
This diff is collapsed.
Click to expand it.
src/libmtime_hl.f90
+
35
−
0
View file @
f720f80c
...
...
@@ -16,8 +16,13 @@ module mtime_hl
private
<<<<<<<
Updated
upstream
PUBLIC
::
t_datetime
,
t_timedelta
PUBLIC
::
t_timedeltaFromMilliseconds
=======
public
::
t_datetime
,
t_timedelta
public
::
min
,
max
>>>>>>>
Stashed
changes
integer
,
parameter
::
i8
=
selected_int_kind
(
14
)
!< at least 8 byte integer
...
...
@@ -94,6 +99,14 @@ module mtime_hl
END
INTERFACE
t_timedeltaFromMilliseconds
interface
min
module
procedure
t_datetime_min
end
interface
min
interface
max
module
procedure
t_datetime_max
end
interface
max
contains
!___________________________________________________________________________
...
...
@@ -324,6 +337,28 @@ contains
call
deallocatetimedelta
(
td_tmp
)
end
function
t_timedelta_to_string
function
t_datetime_min
(
a
,
b
)
result
(
res
)
type
(
t_datetime
)
::
a
,
b
type
(
t_datetime
)
::
res
if
(
a
>
b
)
then
res
=
b
else
res
=
a
end
if
end
function
t_datetime_min
function
t_datetime_max
(
a
,
b
)
result
(
res
)
type
(
t_datetime
)
::
a
,
b
type
(
t_datetime
)
::
res
if
(
a
>
b
)
then
res
=
a
else
res
=
b
end
if
end
function
t_datetime_max
end
module
mtime_hl
!>
!! @}
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