{"action":"created","issue":{"url":"https://api.github.com/repos/gtfierro/giles/issues/40","labels_url":"https://api.github.com/repos/gtfierro/giles/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/gtfierro/giles/issues/40/comments","events_url":"https://api.github.com/repos/gtfierro/giles/issues/40/events","html_url":"https://github.com/gtfierro/giles/issues/40","id":71628270,"number":40,"title":"Intermittent Wrong Timestamps","user":{"login":"ahaas","id":4561872,"avatar_url":"https://avatars.githubusercontent.com/u/4561872?v=3","gravatar_id":"","url":"https://api.github.com/users/ahaas","html_url":"https://github.com/ahaas","followers_url":"https://api.github.com/users/ahaas/followers","following_url":"https://api.github.com/users/ahaas/following{/other_user}","gists_url":"https://api.github.com/users/ahaas/gists{/gist_id}","starred_url":"https://api.github.com/users/ahaas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahaas/subscriptions","organizations_url":"https://api.github.com/users/ahaas/orgs","repos_url":"https://api.github.com/users/ahaas/repos","events_url":"https://api.github.com/users/ahaas/events{/privacy}","received_events_url":"https://api.github.com/users/ahaas/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-04-28T15:53:38Z","updated_at":"2015-04-28T16:45:30Z","closed_at":"2015-04-28T16:19:14Z","body":"The previous issue #37 seems to be fixed when I first make the database, however when I come back to my database a day later, all the timestamps are 1000x again. Clearing my `/tmp` files temporarily resolves it. (This has happened to me several times.)"},"comment":{"url":"https://api.github.com/repos/gtfierro/giles/issues/comments/97133334","html_url":"https://github.com/gtfierro/giles/issues/40#issuecomment-97133334","issue_url":"https://api.github.com/repos/gtfierro/giles/issues/40","id":97133334,"user":{"login":"ahaas","id":4561872,"avatar_url":"https://avatars.githubusercontent.com/u/4561872?v=3","gravatar_id":"","url":"https://api.github.com/users/ahaas","html_url":"https://github.com/ahaas","followers_url":"https://api.github.com/users/ahaas/followers","following_url":"https://api.github.com/users/ahaas/following{/other_user}","gists_url":"https://api.github.com/users/ahaas/gists{/gist_id}","starred_url":"https://api.github.com/users/ahaas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahaas/subscriptions","organizations_url":"https://api.github.com/users/ahaas/orgs","repos_url":"https://api.github.com/users/ahaas/repos","events_url":"https://api.github.com/users/ahaas/events{/privacy}","received_events_url":"https://api.github.com/users/ahaas/received_events","type":"User","site_admin":false},"created_at":"2015-04-28T16:45:30Z","updated_at":"2015-04-28T16:45:30Z","body":"From your documentation, it seems that the timestamp should be consistent with UnitofTime?\r\n```\r\n\"Readings\": [                       // This is an array of (timestamp, value) tuples. Timestamps should be\r\n            [                               //  consistent with Properties/UnitofTime\r\n                1351043674000,              // A timestamp\r\n                0                           // A numeric value\r\n            ],\r\n```\r\n\r\nSecondly, my finding is that all streams return in milliseconds only after the database is _old_, for some reason. If I make a new database and start putting data in it, you can see that the timestamps now match the UnitofTime again, and are in __seconds__ not milliseconds.\r\n\r\n```\r\n~/giles_test❯ curl -X POST -d \"select * where uuid='c76e3e87-65f0-5d4d-8e1a-22fc5684f5a0';\" http://localhost:8079/api/query | jprint\r\n  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\r\n                                 Dload  Upload   Total   Spent    Left  Speed\r\n100   730  100   671  100    59  94948   8348 --:--:-- --:--:-- --:--:--  109k\r\n[\r\n  {\r\n    \"Actuator\": {\r\n      \"path\": \"/tasklighting/group1/sat_act\", \r\n      \"uuid\": \"4662d038-bc2f-5122-a348-846f8b23f35d\"\r\n    }, \r\n    \"Metadata\": {\r\n      \"Building\": \"Soda Hall\", \r\n      \"Device\": \"Lighting Controller\", \r\n      \"DeviceID\": \"905d2818-aa82-11e4-acab-0cc47a0f7eea\", \r\n      \"Driver\": \"smap.drivers.lights.virtuallight\", \r\n      \"Group\": \"1\", \r\n      \"LightingZone\": \"410 Soda\", \r\n      \"Model\": \"Virtual Light\", \r\n      \"Role\": \"Task Lighting\", \r\n      \"Site\": \"0273d18f-1c03-11e4-a490-6003089ed1d0\", \r\n      \"SourceName\": \"Demo Driver\", \r\n      \"System\": \"Lighting\", \r\n      \"Type\": \"Command\", \r\n      \"configured\": \"True\"\r\n    }, \r\n    \"Path\": \"/tasklighting/group1/sat\", \r\n    \"Properties\": {\r\n      \"ReadingType\": \"long\", \r\n      \"Timezone\": \"America/Los_Angeles\", \r\n      \"UnitofMeasure\": \"Saturation\", \r\n      \"UnitofTime\": \"s\"\r\n    }, \r\n    \"uuid\": \"c76e3e87-65f0-5d4d-8e1a-22fc5684f5a0\"\r\n  }\r\n]\r\n~/giles_test❯ curl -X POST -d \"select data before now limit 5 where uuid='c76e3e87-65f0-5d4d-8e1a-22fc5684f5a0';\" http://localhost:8079/api/query | jprint  \r\n  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\r\n                                 Dload  Upload   Total   Spent    Left  Speed\r\n100   248  100   167  100    81    187     90 --:--:-- --:--:-- --:--:--   187\r\n[\r\n  {\r\n    \"Readings\": [\r\n      [\r\n        1430239439.0, \r\n        80\r\n      ], \r\n      [\r\n        1430239438.0, \r\n        80\r\n      ], \r\n      [\r\n        1430239437.0, \r\n        80\r\n      ], \r\n      [\r\n        1430239436.0, \r\n        80\r\n      ], \r\n      [\r\n        1430239435.0, \r\n        80\r\n      ]\r\n    ], \r\n    \"uuid\": \"c76e3e87-65f0-5d4d-8e1a-22fc5684f5a0\"\r\n  }\r\n]\r\n```"}}