Rel: 052
dates052.tgz
Very few modifications - code cleaning
Calendar become Dates Rel: 051
dates051.tgz
Start of some code cleaning and a major change for name
CALENDAR become DATES
WHY :
Main differences with dates and calendar are:
-
date:
is millisec based
limited to timespace 01/01/1970 > today
limited in computations (days+/hour+/minutes+/seconds+)
use GMT timelag but no timezone
-
calendar:
(this will be built in far far futur)
seconds based
not limited in timespace (since 01/01/0000 to defined)
Gregorian or other possible
permit direct setting for day/month/year
adding year/month/day/hour/minutes/seconds according timezone
use timezone (winter/summer time according timezone)
Rel: 05
calendar05.tgz
Many changes according Slava suggestions that simplify the code by a lot
WARNING this release doesn’t work with date < 01/01/1970
this is a major bug. Next release should resolve this issue (I hope).
There is still some parts to simplify and finish.
This code si NOT WELL TESTED and it may containt bugs !!!
-
New generic formater
{ %D “/” %M “/” %Y ” ” %h “:” %m “:” %s } datefmt .
Give “25/07/2005 16:12:18″
-
Calendar functions
localedate
give locate value of milliseconds according timezone
fulldays
number of days since 1/1/1970
year
Year number
month
Month number
monthname
Name of the month according locales
day
Day number
dayname
Name of the day according locales
hour
minutes
seconds
timezone
Value of timezone GMT based
hour+
Add N hours to calendar
min+
Add N min to calendar
sec+
Add N sec to calendar
day+
Add N days to calendar
Parser
Warning parsing is limited to date > 01/01/1970 (anterior date give negative millis:-( probably I should change the internal representation for millisec or hack for negative number ).
calendar-builder take a list in the form [ gmt h mn sec jj mm yyyy ] and build the date. The string date can be parsed like on the exemple parse-fmt-fr in locales.factor.
- Now all the fiels are computed on demand. Hope this is fast enougth.
- Now I have set by default
2 “timezone” set ! default GMT + 2
“fr” “locales” set ! defaut locales france
calendar05.tgz
Rel: 04
- few modifications and changes for Factor 078/079
calendar04.tgz
Rel: 03
- Add simple date parser
- not sure it is bug free
calendar03.zip
not sure it is bug free
calendar03.zip
Exemple of use
“25/7/2005 16:12:18″ parse-fmt-fr .s
<< calendar [ ] 1122307938000 12989 58338 2005 206 7 25 16 12 18 "fr" 0 "fr" >>
calendar>string .
“25/7/2005 16:12″
Of course you need to write your own parser using parse-fmt-fr as exemple
Now I am stopping for few time on calendar , trying another things on Factor
Rel: 02
Following slava comments, some simplifications
- remove stupid t f ?
- remove unusefull GENERIC
- still TODO replace contain? by member? and string date parser
Still the same request on TUPLE
How to remove some mutator field: >> :private thing ?
calendar0.2.zip
Exemple of use
new-calendar
dup calendar>string .
“20/7/2005 7:47″
dup “fr-full” swap set-calendar-locale
dup calendar>string .
“Mercredi 20/7/2005 7:47:49 GMT:0″
dup 2 set-timezone
dup calendar>string .
“20/7/2005 9:47″
warning still probably buggy