Re: Date fromDays: (Dale Henrichs)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Date fromDays: (Dale Henrichs)

Sebastia Van Lacke
Thank you Dale, I have started to use Pharo and I've discovered a lot of useful features from the gemtools panel, like backup support. That was a critical issue for me because I have no idea about Gemstone administration. I have broken the database many times and I had to reinstall it from scratch.
The update button is very useful too, I have updated client and server to 1.0-beta 8 without any problem.
 
I'm still having problems with Date>>fromDays: Now I have the method available, but it brakes on #asSecond.
 
Thanks!
 
Sebastian
Reply | Threaded
Open this post in threaded view
|

Re: Date fromDays: (Dale Henrichs)

Dale Henrichs
Thanks for the report Sebastian...boy that Date class>>fromDays: port
from Squeak was pretty poor:)

I've submitted the Issue 150
(http://code.google.com/p/glassdb/issues/detail?id=150) for tracking
this and I've attached a patch file that should fix the implementation
of Date class>fromDays:

Dale

Sebastian Van Lacke wrote:
> Thank you Dale, I have started to use Pharo and I've discovered a lot of useful features from the gemtools panel, like backup support. That was a critical issue for me because I have no idea about Gemstone administration. I have broken the database many times and I had to reinstall it from scratch.
> The update button is very useful too, I have updated client and server to 1.0-beta 8 without any problem.
>
> I'm still having problems with Date>>fromDays: Now I have the method available, but it brakes on #asSecond.
>
> Thanks!
>
> Sebastian
>


category: '*squeak'
classmethod: Date
fromDays: dayCount
        "Days since 1 January 1901"

        ^ self julianDayNumber: dayCount + 2415386 "julian calendar base"
%

category: '*squeak'
classmethod: Date
julianDayNumber: aJulianDayNumber

        (DateAndTime julianDayNumber: aJulianDayNumber) dayMonthYearDo: [:day :month :year |
                ^ self newDay: day monthNumber: month year: year ]
%

category: '*squeak'
method: Date
julianDayNumber

        ^self asDateAndTime julianDayNumber
%

category: '*squeak'
method: DateAndTime
julianDayNumber

        ^(self - self class epoch) days + 2415386 - 1 "julian calendar base - 1 ??"
%

category: '*squeak'
classmethod: DateAndTime
julianDayNumber: aJulianDayNumber

  ^self epoch + (Duration days: aJulianDayNumber - 2415386 "julian calendar base")
%