{"action":"created","issue":{"url":"https://api.github.com/repos/zussel/oos/issues/70","repository_url":"https://api.github.com/repos/zussel/oos","labels_url":"https://api.github.com/repos/zussel/oos/issues/70/labels{/name}","comments_url":"https://api.github.com/repos/zussel/oos/issues/70/comments","events_url":"https://api.github.com/repos/zussel/oos/issues/70/events","html_url":"https://github.com/zussel/oos/issues/70","id":195752037,"number":70,"title":"OSX time related build failures","user":{"login":"saki7","id":1901813,"avatar_url":"https://avatars.githubusercontent.com/u/1901813?v=3","gravatar_id":"","url":"https://api.github.com/users/saki7","html_url":"https://github.com/saki7","followers_url":"https://api.github.com/users/saki7/followers","following_url":"https://api.github.com/users/saki7/following{/other_user}","gists_url":"https://api.github.com/users/saki7/gists{/gist_id}","starred_url":"https://api.github.com/users/saki7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saki7/subscriptions","organizations_url":"https://api.github.com/users/saki7/orgs","repos_url":"https://api.github.com/users/saki7/repos","events_url":"https://api.github.com/users/saki7/events{/privacy}","received_events_url":"https://api.github.com/users/saki7/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-15T09:10:23Z","updated_at":"2016-12-15T09:46:58Z","closed_at":null,"body":"Refs #69:\r\n\r\n> All these \"item already exists\" errors are following errors. The root failure is test QueryTestUnit::test_datatypes(). There the time comparison fails and therefor the created table item will not be dropped.\r\n\r\n> I'll change the UNIT_ASSERT_EQUAL checks into UNIT_EXPECT_EQUAL which will count as error but keep the test running.\r\n\r\n> But I still don't why the time comparison fails on OSX and since I have not OSX VM set up I'll leave this as allow failure in travis.\r\n\r\n---\r\n\r\nThere are two major issues:\r\n\r\n> 1: \tFAILURE at /Users/travis/build/zussel/oos/test/sql/QueryTestUnit.cpp:116: value 2015-03-15T13:56:23 is not equal 2015-03-15T13:56:23: time is not equal\r\n\r\n- `2015-03-15T13:56:23`\r\n- `2015-03-15T13:56:23`\r\n\r\nThey are actually the *same*.\r\nSo looking into the comparison\r\n\r\n```cpp\r\nbool time::operator==(const time &x) const\r\n{\r\n  return time_.tv_sec == x.time_.tv_sec &&\r\n    time_.tv_usec == x.time_.tv_usec;\r\n}\r\n```\r\nhttps://github.com/zussel/oos/blob/aa7af415756b3844c75fc98bf5f403a3bffebf66/lib/src/tools/time.cpp#L110\r\n\r\nAnd the implementation `void time::set()`\r\n\r\n```cpp\r\nthis->time_.tv_sec = mktime(&t);\r\n```\r\n\r\n```cpp\r\nthis->time_.tv_usec = millis * 1000;\r\n```\r\n\r\nhttps://github.com/zussel/oos/blob/aa7af415756b3844c75fc98bf5f403a3bffebf66/lib/src/tools/time.cpp#L219\r\n\r\nOne of them must be wrong. (A simple guess would be like an uninitialized value is being set to usec or something.) \r\nBtw I'm wondering if there's a need to compare both sec and usec. If both of them are representing elapsed values from a certain time period, just comparing one of them (and that should be usec) is fine. Am I correct?\r\n\r\n---\r\n\r\nAnd another failure\r\n\r\n> 1: \tFAILURE at /Users/travis/build/zussel/oos/test/tools/TimeTestUnit.cpp:284: value 11:35:07.f 31.01.2015 is not equal 11:35:07.123 31.01.2015: invalid time string [11:35:07.f 31.01.2015]\r\n\r\n- `11:35:07.f 31.01.2015`\r\n- `11:35:07.123 31.01.2015`\r\n\r\nSee the line for `to_string()`\r\nhttps://github.com/zussel/oos/blob/14e7c0abaac216b5964651b71aa6606b545b2f12/lib/src/tools/string.cpp#L90\r\n\r\nI think `std::strftime()` is the one.\r\nSince `%` is a special character in `strftime` context, you should always escape the string before passing into it. And the behavior might be actually implementation-defined so only OSX is failing. In my guess.\r\n\r\nSo you should choose an another identifier rather than `%f` for milliseconds."},"comment":{"url":"https://api.github.com/repos/zussel/oos/issues/comments/267284937","html_url":"https://github.com/zussel/oos/issues/70#issuecomment-267284937","issue_url":"https://api.github.com/repos/zussel/oos/issues/70","id":267284937,"user":{"login":"saki7","id":1901813,"avatar_url":"https://avatars.githubusercontent.com/u/1901813?v=3","gravatar_id":"","url":"https://api.github.com/users/saki7","html_url":"https://github.com/saki7","followers_url":"https://api.github.com/users/saki7/followers","following_url":"https://api.github.com/users/saki7/following{/other_user}","gists_url":"https://api.github.com/users/saki7/gists{/gist_id}","starred_url":"https://api.github.com/users/saki7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saki7/subscriptions","organizations_url":"https://api.github.com/users/saki7/orgs","repos_url":"https://api.github.com/users/saki7/repos","events_url":"https://api.github.com/users/saki7/events{/privacy}","received_events_url":"https://api.github.com/users/saki7/received_events","type":"User","site_admin":false},"created_at":"2016-12-15T09:46:57Z","updated_at":"2016-12-15T09:46:57Z","body":"I think `%%f` is fine - it evaluates to `%f` after `strftime`"}}
{"actor":{"display_login":"saki7"}}