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
ff7088fa
Commit
ff7088fa
authored
6 years ago
by
Jan Frederik Engels
Browse files
Options
Downloads
Patches
Plain Diff
Rap divideInSecondsBy.
parent
5dff8c1b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/example_hl.f90
+10
-3
10 additions, 3 deletions
examples/example_hl.f90
src/libmtime_hl.f90
+15
-1
15 additions, 1 deletion
src/libmtime_hl.f90
with
25 additions
and
4 deletions
examples/example_hl.f90
+
10
−
3
View file @
ff7088fa
...
...
@@ -3,12 +3,14 @@ PROGRAM example
USE
mtime
,
ONLY
:
setCalendar
,
PROLEPTIC_GREGORIAN
USE
mtime_hl
,
ONLY
:
t_datetime
,
t_timedelta
,
min
,
max
,
&
&
t_timedeltaFromMilliseconds
&
t_timedeltaFromMilliseconds
,
&
&
divisionquotienttimespan
IMPLICIT
NONE
TYPE
(
t_datetime
)
::
dt
,
dt2
,
dt3
,
dt4
TYPE
(
t_timedelta
)
::
td
TYPE
(
t_timedelta
)
::
td
,
td1
TYPE
(
divisionquotienttimespan
)
::
dqts
INTEGER
::
test_number1
,
test_number2
,
test_result
...
...
@@ -69,5 +71,10 @@ PROGRAM example
! interval assignment with milliseconds
td
=
t_timedeltaFromMilliseconds
(
360000
)
WRITE
(
0
,
*
)
"interval assignment with milliseconds: "
,
td
%
to_string
()
! division
td1
=
t_timedelta
(
"PT23H42M"
)
dqts
=
td1
%
divideInSecondsBy
(
td
)
WRITE
(
0
,
*
)
td1
%
to_string
(),
" / "
,
td
%
to_string
(),
" = "
,
dqts
%
quotient
,
" plus stuff"
END
PROGRAM
example
This diff is collapsed.
Click to expand it.
src/libmtime_hl.f90
+
15
−
1
View file @
ff7088fa
...
...
@@ -20,6 +20,9 @@ module mtime_hl
PUBLIC
::
t_timedeltaFromMilliseconds
PUBLIC
::
min
,
max
! Re-export stuff from libmtime that is still needed
PUBLIC
::
divisionquotienttimespan
integer
,
parameter
::
i8
=
selected_int_kind
(
14
)
!< at least 8 byte integer
...
...
@@ -78,9 +81,12 @@ module mtime_hl
contains
procedure
::
assign_t_timedelta
procedure
::
t_timedelta_divideInSecondsBy
procedure
::
t_timedelta_to_string
generic
::
divideInSecondsBy
=>
t_timedelta_divideInSecondsBy
generic
::
to_string
=>
t_timedelta_to_string
generic
::
assignment
(
=
)
=>
assign_t_timedelta
...
...
@@ -334,6 +340,14 @@ contains
call
deallocatetimedelta
(
td_tmp
)
end
function
t_timedelta_to_string
function
t_timedelta_divideInSecondsBy
(
this
,
divisor
)
result
(
quotient
)
CLASS
(
t_timedelta
),
INTENT
(
in
)
::
this
TYPE
(
t_timedelta
),
INTENT
(
in
)
::
divisor
TYPE
(
divisionquotienttimespan
)
::
quotient
CALL
divideTimeDeltaInSeconds
(
this
%
td
,
divisor
%
td
,
quotient
)
end
function
t_timedelta_divideInSecondsBy
function
t_datetime_min
(
a
,
b
)
result
(
res
)
type
(
t_datetime
)
::
a
,
b
type
(
t_datetime
)
::
res
...
...
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