Comments (3)
Hi Chris, thanks for submitting this issue. I just noticed this now, I should probably turn on e-mail notifications. Will look into it and let you know what I find. Thanks.
from datetime-fortran.
Hi Chris, I was able to reproduce your bug. Note that the time change was also incorrect for December, indicating that datetime+timedelta(hours=-6)
was misbehaving whenever daysInMonth(datetime%month - 1,datetime%year) < 31
. The bug is fixed by changing the subroutine addDays
from this:
ELSEIF(self%day < 1)THEN
self%day = self%day+daysInCurrentMonth
self%month = self%month-1
to:
ELSEIF(self%day < 1)THEN
self%month = self%month-1
self%day = self%day+daysInMonth(self%month,self%year)
The problem was occuring because switching into a previous month caused the day
component to update using an old value of daysInCurrentMonth
.
The output of your program is now:
2013-01-01T00:00:00.000 -6hrs = 2012-11-30T18:00:00.000
2013-02-01T00:00:00.000 -6hrs = 2013-01-31T18:00:00.000
2013-03-01T00:00:00.000 -6hrs = 2013-02-28T18:00:00.000
2013-04-01T00:00:00.000 -6hrs = 2013-03-31T18:00:00.000
2013-05-01T00:00:00.000 -6hrs = 2013-04-30T18:00:00.000
2013-06-01T00:00:00.000 -6hrs = 2013-05-31T18:00:00.000
2013-07-01T00:00:00.000 -6hrs = 2013-06-30T18:00:00.000
2013-08-01T00:00:00.000 -6hrs = 2013-07-31T18:00:00.000
2013-09-01T00:00:00.000 -6hrs = 2013-08-31T18:00:00.000
2013-10-01T00:00:00.000 -6hrs = 2013-09-30T18:00:00.000
2013-11-01T00:00:00.000 -6hrs = 2013-10-31T18:00:00.000
2013-12-01T00:00:00.000 -6hrs = 2013-11-30T18:00:00.000
This fix has been commited to the master repo.
Thank you for improving datetime-fortran.
from datetime-fortran.
Thanks for fixing this, Milan.
It's a really useful library!
All the best,
Chris.
On 5 February 2014 18:48, Milan Curcic [email protected] wrote:
Reply to this email directly or view it on GitHubhttps://github.com//issues/6
.
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
- Cannot set seconds or others of timedelta HOT 3
- 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.