{"action":"created","issue":{"url":"https://api.github.com/repos/sunpy/sunpy/issues/993","labels_url":"https://api.github.com/repos/sunpy/sunpy/issues/993/labels{/name}","comments_url":"https://api.github.com/repos/sunpy/sunpy/issues/993/comments","events_url":"https://api.github.com/repos/sunpy/sunpy/issues/993/events","html_url":"https://github.com/sunpy/sunpy/issues/993","id":33830776,"number":993,"title":"Use `astropy.time`","user":{"login":"ayshih","id":991759,"avatar_url":"https://avatars.githubusercontent.com/u/991759?v=3","gravatar_id":"","url":"https://api.github.com/users/ayshih","html_url":"https://github.com/ayshih","followers_url":"https://api.github.com/users/ayshih/followers","following_url":"https://api.github.com/users/ayshih/following{/other_user}","gists_url":"https://api.github.com/users/ayshih/gists{/gist_id}","starred_url":"https://api.github.com/users/ayshih/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ayshih/subscriptions","organizations_url":"https://api.github.com/users/ayshih/orgs","repos_url":"https://api.github.com/users/ayshih/repos","events_url":"https://api.github.com/users/ayshih/events{/privacy}","received_events_url":"https://api.github.com/users/ayshih/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2014-05-19T19:51:02Z","updated_at":"2015-08-03T14:09:30Z","closed_at":null,"body":"We should switch to using `astropy.time` instead of `datetime` as much as possible.\r\n\r\nOne reason is that `astropy.time` can handle leap seconds, while `datetime` ignores them.  For the most recently added leap second, which was 23:59:60 on 2012 June 30:\r\n```python\r\n>>> import datetime\r\n>>> datetime.datetime(2012, 6, 30, 23, 59, 60)\r\nERROR: ValueError: second must be in 0..59 [unknown]\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\nValueError: second must be in 0..59\r\n\r\n>>> from astropy.time import Time, TimeDelta\r\n\r\n>>> t1 = Time('1958-01-01', scale='tai') + TimeDelta(1719792035, format='sec')\r\n>>> t1.utc\r\n<Time object: scale='utc' format='iso' value=2012-07-01 00:00:00.000>\r\n>>> t1.utc.datetime\r\ndatetime.datetime(2012, 7, 1, 0, 0)\r\n\r\n>>> t2 = Time('1958-01-01', scale='tai') + TimeDelta(1719792034, format='sec')\r\n>>> t2.utc\r\n<Time object: scale='utc' format='iso' value=2012-06-30 23:59:60.000>\r\n>>> t2.utc.datetime\r\nERROR: ValueError: second must be in 0..59 [astropy.time.core]\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"c:\\Python27\\lib\\site-packages\\astropy\\time\\core.py\", line 561, in __getattr__\r\n    out = tm._time.value[0]\r\n  File \"c:\\Python27\\lib\\site-packages\\astropy\\time\\core.py\", line 1348, in value\r\n    int(ihr), int(imin), int(isec), int(ifracsec))\r\nValueError: second must be in 0..59\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/sunpy/sunpy/issues/comments/127254528","html_url":"https://github.com/sunpy/sunpy/issues/993#issuecomment-127254528","issue_url":"https://api.github.com/repos/sunpy/sunpy/issues/993","id":127254528,"user":{"login":"Cadair","id":1391051,"avatar_url":"https://avatars.githubusercontent.com/u/1391051?v=3","gravatar_id":"","url":"https://api.github.com/users/Cadair","html_url":"https://github.com/Cadair","followers_url":"https://api.github.com/users/Cadair/followers","following_url":"https://api.github.com/users/Cadair/following{/other_user}","gists_url":"https://api.github.com/users/Cadair/gists{/gist_id}","starred_url":"https://api.github.com/users/Cadair/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Cadair/subscriptions","organizations_url":"https://api.github.com/users/Cadair/orgs","repos_url":"https://api.github.com/users/Cadair/repos","events_url":"https://api.github.com/users/Cadair/events{/privacy}","received_events_url":"https://api.github.com/users/Cadair/received_events","type":"User","site_admin":false},"created_at":"2015-08-03T14:09:30Z","updated_at":"2015-08-03T14:09:30Z","body":"@wafels The time representation in LightCurve is separate from the standalone representation.\r\n\r\n I think we need to leave this until we have someone with time to work on time. (ya see what I did there!?)"}}