{"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":175,"created_at":"2015-07-24T12:25:08Z","updated_at":"2015-08-10T07:51:50Z","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/129344447","html_url":"https://github.com/daokoder/dao-modules/issues/66#issuecomment-129344447","issue_url":"https://api.github.com/repos/daokoder/dao-modules/issues/66","id":129344447,"user":{"login":"Night-walker","id":5074460,"avatar_url":"https://avatars.githubusercontent.com/u/5074460?v=3","gravatar_id":"","url":"https://api.github.com/users/Night-walker","html_url":"https://github.com/Night-walker","followers_url":"https://api.github.com/users/Night-walker/followers","following_url":"https://api.github.com/users/Night-walker/following{/other_user}","gists_url":"https://api.github.com/users/Night-walker/gists{/gist_id}","starred_url":"https://api.github.com/users/Night-walker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Night-walker/subscriptions","organizations_url":"https://api.github.com/users/Night-walker/orgs","repos_url":"https://api.github.com/users/Night-walker/repos","events_url":"https://api.github.com/users/Night-walker/events{/privacy}","received_events_url":"https://api.github.com/users/Night-walker/received_events","type":"User","site_admin":false},"created_at":"2015-08-10T07:51:50Z","updated_at":"2015-08-10T07:51:50Z","body":"> I do understand what DateTimeDiff is, it is similar to what I have considered about TimeInterval which is defined by a starting date time and an ending date time. It is very simple, maybe too simple.\r\n> \r\n> If you just want to extract time length from it, it is Ok. But it has to support other operations to make it a reasonable type. I cannot imagine it to be a reasonable type if it does not support the following operations:\r\n> \r\n> DateTimeDiff = DateTime - DateTime\r\n> DateTime = DateTime + DateTimeDiff\r\n> As I mentioned before, here comes problems. The second operation is not well defined for your DateTimeDiff!\r\n\r\nNo you don't understand :) I already said that `DateTimeDiff` is not supposed to support any operations with datetimes or time spans or whatever. It is neither a value nor a result of any kind. It just a way to group functions together, so that instead of `daysBetween()`, `DateTime::add()` and so on there is single subtraction."}}