{"action":"created","issue":{"url":"https://api.github.com/repos/daokoder/dao-modules/issues/66","labels_url":"https://api.github.com/repos/daokoder/dao-modules/issues/66/labels{/name}","comments_url":"https://api.github.com/repos/daokoder/dao-modules/issues/66/comments","events_url":"https://api.github.com/repos/daokoder/dao-modules/issues/66/events","html_url":"https://github.com/daokoder/dao-modules/issues/66","id":97041398,"number":66,"title":"Redesigning the \"DateTime\" type in the \"time\" module","user":{"login":"daokoder","id":1860002,"avatar_url":"https://avatars.githubusercontent.com/u/1860002?v=3","gravatar_id":"","url":"https://api.github.com/users/daokoder","html_url":"https://github.com/daokoder","followers_url":"https://api.github.com/users/daokoder/followers","following_url":"https://api.github.com/users/daokoder/following{/other_user}","gists_url":"https://api.github.com/users/daokoder/gists{/gist_id}","starred_url":"https://api.github.com/users/daokoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daokoder/subscriptions","organizations_url":"https://api.github.com/users/daokoder/orgs","repos_url":"https://api.github.com/users/daokoder/repos","events_url":"https://api.github.com/users/daokoder/events{/privacy}","received_events_url":"https://api.github.com/users/daokoder/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/daokoder/dao-modules/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":159,"created_at":"2015-07-24T12:25:08Z","updated_at":"2015-08-08T16:04:44Z","closed_at":null,"body":"I just added a new C wrapping type for plain old data (POD): `DaoCpod`, which is the same as `DaoCstruct`, but supports copying (bit-wise) on assignment. Namely, `DaoCpod` is handled like a primitive type for assignment.\r\n\r\nI am trying to redesign `DateTime` and wrap it as POD type. The main difference I will make is:\r\n  * It will supports fraction seconds (micro-second resolution);\r\n  * ~~It will be timezone neutral, and is always obtained as UTC; conversion to local time must be done explicitly~~ (Edit: changed mind);\r\n  * It will be wrapped as `DaoCpod` (more efficient);\r\n  * It will be a variable type instead of an invariable type; there will be no problem of being used as map keys;\r\n\r\nFor a timestamp, it will be encoded as bit combination (64-bit timestamp) for year, month and day etc., instead of elapse of seconds or microseconds; The reason for this is that, it is difficult to compute the precise seconds elapsed since a given epoch due to the existence of leap seconds (if I understand correctly).\r\n"},"comment":{"url":"https://api.github.com/repos/daokoder/dao-modules/issues/comments/128993441","html_url":"https://github.com/daokoder/dao-modules/issues/66#issuecomment-128993441","issue_url":"https://api.github.com/repos/daokoder/dao-modules/issues/66","id":128993441,"user":{"login":"dumblob","id":2451044,"avatar_url":"https://avatars.githubusercontent.com/u/2451044?v=3","gravatar_id":"","url":"https://api.github.com/users/dumblob","html_url":"https://github.com/dumblob","followers_url":"https://api.github.com/users/dumblob/followers","following_url":"https://api.github.com/users/dumblob/following{/other_user}","gists_url":"https://api.github.com/users/dumblob/gists{/gist_id}","starred_url":"https://api.github.com/users/dumblob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dumblob/subscriptions","organizations_url":"https://api.github.com/users/dumblob/orgs","repos_url":"https://api.github.com/users/dumblob/repos","events_url":"https://api.github.com/users/dumblob/events{/privacy}","received_events_url":"https://api.github.com/users/dumblob/received_events","type":"User","site_admin":false},"created_at":"2015-08-08T16:04:44Z","updated_at":"2015-08-08T16:04:44Z","body":"I'm still convinced the current algorithm in `DateTime::add()` is not correct due to multiple crossings and also that the anchoring in `TimeSpan` doesn't solve the issue of different offset and thus different day calculations (as described above on the subtraction example). I wanted to prepare several examples, but immediately got stuck with:\r\n~~~~\r\n0$ dao -e 'load time import time; TimeSpan(years=1)'\r\n[[Error::Time]] --- :\r\nInvalid time span\r\nRaised by:  TimeSpan.TimeSpan(), from namespace \"time\";\r\nIn code snippet:\r\n      3 :  GETCL       :     0 ,     0 ,     3 ;     1;   years=1\r\n>>    4 :  CALL        :     2 ,     1 ,     4 ;     1;   TimeSpan(years=1)\r\n      5 :  RETURN      :     4 ,     1 ,     0 ;     1;   )\r\nCalled by:  __main__(), at instruction 4 in line 1 in file \"command line codes\";\r\n~~~~"}}