Commit Graph

65 Commits

Author SHA1 Message Date
arkdro
511c7815dc remove catch-all branch 2013-03-02 14:16:55 +04:00
arkdro
7bcd1596b0 add api to check whether the dst is active 2013-02-21 00:07:14 +04:00
aj heller
d7d8f70463 Merge pull request #10 from arkdro/master
load tzdata from `tzdata_dir` env if set, or fall back to old behavior.
2013-02-12 12:56:05 -08:00
arkdro
406fba57f2 use env for tzdata_dir 2013-02-13 00:46:56 +04:00
aj heller
ca64849fed fixes #7; adds many tests for #7; cleans up ezic_flatten debug messages
Issue #7: Some Zones no longer observing DST are broen.

The matchspec generation function for universal time was wrong,
whereas it was fine for wall and local times. Fixing that line, and
considering the `current` flatzone time, was enough to get TZs like
Tokyo and Jamaica working correctly in tested cases.
2012-12-17 23:55:37 -08:00
aj heller
959bb8a2a3 adds flatzone lookup by TzName to both db implementations 2012-12-17 23:52:20 -08:00
aj heller
8e4dcb784b makes ezic:local_to_utc errors into values; updates tests accordingly
Like in d98eed, errors are now returned as values rather than crashing
processes. This is a short-term solution for consistency, and can be
refactored to a saner model later.
2012-12-17 22:07:56 -08:00
aj heller
2d12d7a45b links to contributor page in README.md 2012-12-17 18:18:37 -08:00
aj heller
8d4109aadf updates README; removes unused functions 2012-12-17 18:14:44 -08:00
aj heller
843a03c09b make test works again 2012-12-17 18:10:07 -08:00
aj heller
aa79af71aa fixes db crash; simplifies the ezic_db proxy module
The db crash happens when calling `ezic_db:get_all(X)` when `X` is not
a valid table name. `ezic_db_ets` crashes, causing the `ezic_db`
server to crash, tossing the database with it. The solution prevents
ezic_db_ets:get_all/1 from crashing, and instead returns an error
value.

The simplification here eliminated some code through
deduplication. The `handle_call` functions could be improved
similarly.
2012-12-17 18:02:16 -08:00
aj heller
d98eed7b52 implements a fix for losing the ets dbs on a bad lookup
The `ezic_db` server would crash on a bad lookup (no_zone,
ambiguous_zone, etc.). The old error notification method for bad
lookups (crashing) was killing the server and apparently eliminating
the in-memory tables.
2012-12-17 16:06:06 -08:00
aj heller
52ad0119cb removes unused code and changes variable names for clarity 2012-12-17 15:22:59 -08:00
aj heller
55f934e735 change README setup instructions for application startup 2012-12-17 14:03:02 -08:00
aj heller
31d131f6a6 change setup instructions to reflect new problematic files in tzdata archive 2012-12-17 13:55:48 -08:00
aj heller
d68978ccdc change setup instructions to reflect new TZData home 2012-12-17 13:46:47 -08:00
lsowen
e535590013 working implementation of mnesia and ets based ezic. 2012-12-05 15:14:21 -05:00
lsowen
2866c9c505 I think I solved the deadlock of nested gen_server:call()s 2012-12-05 13:17:20 -05:00
lsowen
4f3364a76d Much cleaner, but not working, because I have a circular loop 2012-12-04 21:36:44 -05:00
aj heller
676e112600 Merge pull request #5 from lsowen/ets_work
Continue work on migrating for mnesia backed to ets backed
2012-11-27 14:27:11 -08:00
lsowen
9d0df77b29 Now using named ets tables.
More closely mirrors the design of the mnesia backed version.
2012-11-07 14:06:27 -05:00
lsowen
fe6db38bec flatzone call was returning a list.
Update return value convention in ezic_db_ets:flatzone() to match ezic_db:flatzone().
2012-11-02 23:06:34 -04:00
lsowen
e8385d7d86 move forward on the transition to ets over mnesia 2012-11-02 22:50:17 -04:00
aj heller
fe2c490734 Update README.md 2012-09-30 22:11:07 -07:00
aj heller
2374ab1394 Merge pull request #4 from amasyura/patch-1
include vsn in ezic.app.src
2012-09-30 21:58:53 -07:00
amasyura
68e87bf876 Update src/ezic.app.src
Add "vsn" in order to satisfy "rebar get-deps"
2012-09-26 10:21:11 +04:00
aj
a90d6246ec moving from mnesia to ets. matchspecs are complicated when dates and atoms are involved. 2010-11-18 00:28:50 -08:00
aj
63c8a29198 updated the readme. error-tested the local_to_utc methods. light changes to the makefile 2010-11-14 01:38:23 -08:00
aj
bd4e6078f2 ezic:local_to_utc/2 added, working.
in the case of ambiguous timezones, an "ambiguous_zone" error is thrown with the two valid zones.
if no zones existed for the given local time (i.e. DST eliminated the hour in question), a "no_zone" error is thrown.
otherwise, the date is returned
2010-11-14 00:46:00 -08:00
aj
22395e2f47 max_year base case bug fixed. ezic:localtime/1 works.
the final flatzone for every Zone should end at "current" for every *_to time. This is inaccurate, but accuracy is only guaranteed up to ?MAX_YEAR (=2500 by default).
that working, I fleshed out the few methods required to get ezic:utc_to_localtime/2 working, thus localtime/1 working. I've only tested localtime/1 at this point.
additionally, mnesia appears to have its data corrupted every time I stop and start a node. I've got to read up on working with mnesia; it's not behaving as I would expect.
2010-11-14 00:27:44 -08:00
aj
d664384c60 Costa Rica's flatzones aren't processed after 1992. Gotta check her out. 2010-11-13 22:54:44 -08:00
aj
3f438e66e0 handled case where zone and rule both end. dealing with Tripoli recursion bug (ambiguous year in ezic_date:for_rule) 2010-11-13 03:25:50 -08:00
aj
a7b0adcbce repaired ezic_date:add_offset. able to normalize plain dates. notes and tests
add_offset was calculating DST differences wrong. It assumed to lose an hour, DST would be {-1,0,0}, in fact, DST went from {1,0,0} to {0,0,0}. add_offset now uses their differences (hence requires both as arguments)
normalize/2 was added to be able to set an arbitrary flag on a plain (i.e. native erlang datetime tuple) date. This is complicated by the fact that atoms "minimum", "max", etc. are still valid and need to fall through the normalization unaltered (for now).
2010-11-12 03:07:15 -08:00
aj
3e77287db6 there is a subtle bug in wall-time calculations. Asia/Irkutsk times are incorrect. 2010-11-12 01:22:50 -08:00
aj
7985f9e74f zone end projection was buggy, since it didn't normalize dates before passing them on (required for ezic_date:all_times/1) 2010-11-12 00:17:20 -08:00
aj
e042ad5ea9 updated some comments to be more accurate, more descriptive 2010-11-12 00:05:57 -08:00
aj
1340f64d8b semantic api change: flatten_zones -> flatten_all_zones. 2010-11-11 23:54:38 -08:00
aj
c976e63349 removed all warnings. fixed bug in ezic_zone:next/3. unit tests for ezic_zone:next/3
ezic_zone:next/3 was not filtering the Zones to only those after UTCFrom. This may have caused an endless loop, always returning the earliest zone regardless of the progress of time. I wont know; I caught it rather early.
2010-11-11 23:52:10 -08:00
aj
1520c631ef roughed-in the "nested" rule processing (flatten). hurdle on rule years->max. 2010-11-10 13:01:03 -08:00
aj
e48e793a36 flattening algorithm needs to be reworked.
also, datetime methods aren't consistent in their naming and return values.
2010-11-10 03:18:57 -08:00
aj
d84a0c1822 datetime manipulation is now much clearer. tests were added, and expectations stated explicitly in many places. rules got lots of attention. 2010-11-10 01:52:13 -08:00
aj
216a8d9ff8 brainstorming the flattening algorithm, slight API change 2010-11-09 23:32:25 -08:00
aj
d00937c3e9 lots of gutting. purposes, input, and output were unclear in many places. still broken. 2010-11-08 01:29:15 -08:00
aj
9ad8f3c826 lots of work towards flattening the records. stalled at ezic_rule:next_event/4 2010-11-07 18:32:37 -08:00
aj
c795abf2b6 misspelled "Olson". sorry 'bout that, Art. 2010-11-07 13:00:21 -08:00
aj
329f699e51 alerted to buginess in README. added notes & zic reference. removed local_to_utc conversion for now.
Time comparisons are patently wrong. They do not consider s/w/u/g/z time modifiers, so the comparisons can be off by hours. At least 24 hours within any time or zone change, ezic will give unreliable results.
I think a solution can involve "flattening" the data, starting from the earliest time possible for each zone/rule, going forward.
There exist ambiguous local times for zones and rules. For example, on Nov 7th, in Los Angeles, the times from 1:00:00am to 1:59:59am were repeated, once for PDT and once for PST. Given a local time in that zone between those times, we cannot determine what UTC time is unambiguously. Similar for Zone transitions where fall-back occurs.
2010-11-07 12:52:51 -08:00
aj
4d95017b7f made License terms more explicit 2010-11-07 00:56:23 -07:00
aj
65ff337301 added stub of next_timechange method. 2010-11-06 17:13:15 -07:00
aj
2e424038a2 README smithing. License update 2010-11-04 22:15:49 -07:00
aj
9178a6c148 README smithing 2010-11-04 22:02:13 -07:00