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
3ff34d30
Commit
3ff34d30
authored
6 years ago
by
Jan Frederik Engels
Browse files
Options
Downloads
Patches
Plain Diff
Add t_timedelta%toSeconds() / %toMilliSeconds()
parent
187d52ca
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
+4
-0
4 additions, 0 deletions
examples/example_hl.f90
src/libmtime_hl.f90
+20
-0
20 additions, 0 deletions
src/libmtime_hl.f90
with
24 additions
and
0 deletions
examples/example_hl.f90
+
4
−
0
View file @
3ff34d30
...
...
@@ -80,4 +80,8 @@ PROGRAM example
! produce error
dt
=
t_datetime
(
"1970--01-01T00:00:00"
)
! toSeconds, toMilliSeconds
WRITE
(
0
,
*
)
td
%
to_string
(),
" is in seconds "
,
td
%
toSeconds
(
dt
)
WRITE
(
0
,
*
)
td
%
to_string
(),
" is in milliseconds "
,
td
%
toMilliSeconds
(
dt
)
END
PROGRAM
example
This diff is collapsed.
Click to expand it.
src/libmtime_hl.f90
+
20
−
0
View file @
3ff34d30
...
...
@@ -85,6 +85,8 @@ module mtime_hl
procedure
::
assign_t_timedelta
procedure
::
t_timedelta_divideInSecondsBy
procedure
::
t_timedelta_toSeconds
procedure
::
t_timedelta_toMilliSeconds
procedure
::
equal_datetime
=>
t_timedelta_equal
procedure
::
not_equal_datetime
=>
t_timedelta_not_equal
...
...
@@ -100,6 +102,8 @@ module mtime_hl
procedure
::
t_timedelta_to_string
generic
::
divideInSecondsBy
=>
t_timedelta_divideInSecondsBy
generic
::
toSeconds
=>
t_timedelta_toSeconds
generic
::
toMilliSeconds
=>
t_timedelta_toMilliSeconds
generic
::
to_string
=>
t_timedelta_to_string
...
...
@@ -524,6 +528,22 @@ contains
CALL
divideTimeDeltaInSeconds
(
this
%
td
,
divisor
%
td
,
quotient
)
end
function
t_timedelta_divideInSecondsBy
function
t_timedelta_toSeconds
(
this
,
td
)
result
(
seconds
)
CLASS
(
t_timedelta
),
INTENT
(
in
)
::
this
TYPE
(
t_datetime
),
INTENT
(
in
)
::
td
INTEGER
(
c_int64_t
)
::
seconds
seconds
=
getTotalSecondsTimeDelta
(
this
%
td
,
td
%
dt
)
end
function
t_timedelta_toSeconds
function
t_timedelta_toMilliSeconds
(
this
,
td
)
result
(
ms
)
CLASS
(
t_timedelta
),
INTENT
(
in
)
::
this
TYPE
(
t_datetime
),
INTENT
(
in
)
::
td
INTEGER
(
c_int64_t
)
::
ms
ms
=
getTotalMilliSecondsTimeDelta
(
this
%
td
,
td
%
dt
)
end
function
t_timedelta_toMilliSeconds
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