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
5bcba659
Commit
5bcba659
authored
7 years ago
by
Florian Prill
Browse files
Options
Downloads
Patches
Plain Diff
fixed missing initialization; added test to example.
parent
ac66aeae
No related branches found
Branches containing commit
Tags
1.0.6
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/example.f90
+32
-0
32 additions, 0 deletions
examples/example.f90
src/mtime_timedelta.c
+2
-0
2 additions, 0 deletions
src/mtime_timedelta.c
with
34 additions
and
0 deletions
examples/example.f90
+
32
−
0
View file @
5bcba659
...
...
@@ -21,6 +21,7 @@ program example
type
(
datetime
),
pointer
::
start_date_tmp
type
(
datetime
),
pointer
::
start_date_test
type
(
datetime
),
pointer
::
stop_date
type
(
datetime
),
pointer
::
end_date
type
(
timedelta
),
pointer
::
time_step
...
...
@@ -119,6 +120,8 @@ contains
type
(
datetime
),
pointer
::
dt1
=>
null
(),
dt2
=>
null
()
character
(
len
=
MAX_TIMEDELTA_STR_LEN
)
::
td_string
character
(
len
=
MAX_DATETIME_STR_LEN
)
::
dstring
TYPE
(
timedelta
),
POINTER
::
time_delta
CHARACTER
(
LEN
=
MAX_DATETIME_STR_LEN
)
::
dt_string
mtime_td
=>
newTimedelta
(
"PT1H1M1S"
)
mtime_td
=
mtime_td
*
0.3d0
...
...
@@ -230,6 +233,35 @@ contains
call
deallocateDatetime
(
dt2
)
call
deallocateTimedelta
(
mtime_td
)
CALL
setCalendar
(
PROLEPTIC_GREGORIAN
)
start_date
=>
newDatetime
(
"2017-07-01T00:00:00.000"
)
end_date
=>
newDatetime
(
"2017-07-31T00:00:00.000"
)
time_delta
=>
newTimeDelta
(
"P01D"
)
time_delta
=
end_date
-
start_date
CALL
datetimeToString
(
start_date
,
dt_string
)
WRITE
(
0
,
*
)
"start_date = "
,
TRIM
(
dt_string
)
CALL
datetimeToString
(
end_date
,
dt_string
)
WRITE
(
0
,
*
)
"end_date = "
,
TRIM
(
dt_string
)
CALL
timedeltaToString
(
time_delta
,
td_string
)
WRITE
(
0
,
*
)
"difference (P30D) = "
,
TRIM
(
td_string
)
CALL
deallocateDatetime
(
start_date
)
CALL
deallocateDatetime
(
end_date
)
CALL
deallocateTimedelta
(
time_delta
)
start_date
=>
newDatetime
(
"2017-07-01T00:00:00.000"
)
end_date
=>
newDatetime
(
"2017-08-01T00:00:00.000"
)
time_delta
=>
newTimeDelta
(
"P01D"
)
time_delta
=
end_date
-
start_date
CALL
datetimeToString
(
start_date
,
dt_string
)
WRITE
(
0
,
*
)
"start_date = "
,
TRIM
(
dt_string
)
CALL
datetimeToString
(
end_date
,
dt_string
)
WRITE
(
0
,
*
)
"end_date = "
,
TRIM
(
dt_string
)
CALL
timedeltaToString
(
time_delta
,
td_string
)
WRITE
(
0
,
*
)
"difference (P01M) = "
,
TRIM
(
td_string
)
CALL
deallocateDatetime
(
start_date
)
CALL
deallocateDatetime
(
end_date
)
CALL
deallocateTimedelta
(
time_delta
)
end
subroutine
icon_tests
subroutine
event_tests
...
...
This diff is collapsed.
Click to expand it.
src/mtime_timedelta.c
+
2
−
0
View file @
5bcba659
...
...
@@ -1082,6 +1082,8 @@ julianDeltaToTimeDelta(struct _juliandelta* jd, struct _datetime* base_dt, struc
/* } */
/* } */
td_return
->
month
=
0
;
td_return
->
day
=
(
int
)
delta_final_year
;
for
(
i
=
NO_OF_MONTHS_IN_A_YEAR
;
i
>
0
;
i
--
)
{
if
(
delta_final_year
>=
msdinm
[
base_dt
->
date
.
month
-
1
][
i
])
...
...
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