Comments (3)
I can't reproduce this... Also, you need to post more of your code.
cat foo.f90
program foo
use mod_timedelta
implicit none
integer, parameter :: time_step_size_in = 5
type(timedelta) :: time_step_size
time_step_size = timedelta(seconds=time_step_size_in)
end program
$ gfortran --version
GNU Fortran (Homebrew GCC 7.2.0) 7.2.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ gfortran -Wall -Wextra -pedantic -c timedelta.f90
$ gfortran -Wall -Wextra -pedantic foo.f90 timedelta.o
$ ./a.out
from datetime-fortran.
@dongli Thank you for reporting this.
Can you show a minimal complete example of how you are using timedelta
?
Specifically, what is the type of time_step_size_in
? My guess is that it is a real
number. timedelta_constructor
function which overloads the default timedelta
constructor, is designed for integer
arguments only. If you try to pass a real
, compiler will not resolve this interface.
An example below with integer arguments works as expected:
use datetime_module,only:timedelta
implicit none
type(timedelta) :: td
td = timedelta(seconds=60)
write(*,*)td % total_seconds()
end
In the above example, if you change 60
to 60.
, you can reproduce your original error message.
Note that you can specify a fraction of seconds like this:
td = timedelta(seconds=60, milliseconds=123)
but the precision is still limited to milliseconds.
This raises a few questions about the design of timedelta
object:
- Should it be able to accept
reals
? - Should the user be able to set timedelta components? Currently this is not possible because
timedelta
is designed as an immutable. If you ever want to change a component, you just create a new instance.
from datetime-fortran.
No response from OP, assume resolved.
from datetime-fortran.
Related Issues (20)
- Document building with cmake and autotools HOT 1
- Define output (write) methods for datetime and timedelta instances HOT 1
- strptime does not handle errors HOT 1
- strptime does not zero tm struct before calling c_strptime HOT 1
- Error invoking datetime constructor with ifort-17.0.5 HOT 10
- Very strange (possibly compiler) bug with date2num HOT 3
- incorrect literal with REAL64 kind HOT 8
- add support for mingw HOT 1
- Can't build tests on win-ifort. Fails on linker with strptime HOT 4
- "undefined reference" when using datetime-fortran HOT 7
- Building with autotools (not all libs are copied) HOT 9
- Dealing with huge timedelta values HOT 5
- Generic procedure including a sub-class of TimeDelta HOT 3
- Bug in function now() HOT 2
- Strptime Undefined Reference Error HOT 7
- Hour comparison in num2date is incorrect HOT 2
- Function that ingests ISO format and returns datetime? HOT 1
- CMake uses different compiler flags to autotools HOT 6
- Processing of `secondsSinceEpoch` and its reverse processing routine. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from datetime-fortran.