{
  "id": 245383,
  "title": "millisSinceGPSEpoch vs utcTimeMillis",
  "url": "/competitions/google-smartphone-decimeter-challenge/discussion/245383",
  "author_name": "",
  "post_date": "2021-06-10T18:44:49.218518700Z",
  "votes": 2,
  "comment_count": 5,
  "views": 0,
  "content": "<p>I would like sync millisSinceGPSEpoch with utcTimeMillis in order to use IMU and Magnetometer data. millisSinceGPSEpoch represents number of milliseconds elapsed after since the GPS epoch (1980/1/6 midnight UTC) and is expressed in GPS time. utcTimeMillis represents milliseconds elapsed after UTC epoch (1970/1/1), represented in UTC time? (are these definitions correct)</p>\n<p>Is the following conversion from utcTimeMillis to millisSinceGPSEpoch correct:<br>\nmillisSinceGPSEpoch = utcTimeMillis - convertToMillis(datetime(1980, 1, 6) - datetime(1980, 1, 6))  + leapMilliSecondsAsOfToday</p>",
  "messages": [
    {
      "id": "1344270",
      "postDate": "06/10/2021 18:44:49",
      "content": "<p>I would like sync millisSinceGPSEpoch with utcTimeMillis in order to use IMU and Magnetometer data. millisSinceGPSEpoch represents number of milliseconds elapsed after since the GPS epoch (1980/1/6 midnight UTC) and is expressed in GPS time. utcTimeMillis represents milliseconds elapsed after UTC epoch (1970/1/1), represented in UTC time? (are these definitions correct)</p>\n<p>Is the following conversion from utcTimeMillis to millisSinceGPSEpoch correct:<br>\nmillisSinceGPSEpoch = utcTimeMillis - convertToMillis(datetime(1980, 1, 6) - datetime(1980, 1, 6))  + leapMilliSecondsAsOfToday</p>",
      "rawMarkdown": "I would like sync millisSinceGPSEpoch with utcTimeMillis in order to use IMU and Magnetometer data. millisSinceGPSEpoch represents number of milliseconds elapsed after since the GPS epoch (1980/1/6 midnight UTC) and is expressed in GPS time. utcTimeMillis represents milliseconds elapsed after UTC epoch (1970/1/1), represented in UTC time? (are these definitions correct)\n\nIs the following conversion from utcTimeMillis to millisSinceGPSEpoch correct:\nmillisSinceGPSEpoch = utcTimeMillis - convertToMillis(datetime(1980, 1, 6) - datetime(1980, 1, 6))  + leapMilliSecondsAsOfToday",
      "votes": null
    },
    {
      "id": "1354534",
      "postDate": "06/17/2021 16:36:26",
      "content": "<p>Hi Arjun, your formula looks good to me, except for convertToMillis(datetime(1980, 1, 6) - datetime(1970, 1, 1)).</p>",
      "rawMarkdown": "Hi Arjun, your formula looks good to me, except for convertToMillis(datetime(1980, 1, 6) - datetime(1970, 1, 1)).",
      "votes": null
    },
    {
      "id": "1356310",
      "postDate": "06/18/2021 22:46:57",
      "content": "<p>Hi, I had the same problem - not very sure about <code>+leapMilliSecondsAsOfToday</code> - not getting what \"today\" has got to do with it? I'm a bit confused sorry.</p>\n<p>Empirically, it seems utcTimeMillis - millisSinceGPSEpoch = 315964782000? Can someone please confirm this?</p>",
      "rawMarkdown": "Hi, I had the same problem - not very sure about `+leapMilliSecondsAsOfToday` - not getting what \"today\" has got to do with it? I'm a bit confused sorry.\n\nEmpirically, it seems utcTimeMillis - millisSinceGPSEpoch = 315964782000? Can someone please confirm this?",
      "votes": null
    },
    {
      "id": "1359097",
      "postDate": "06/21/2021 04:43:25",
      "content": "<p>Just wanted to say that I find the host's involvement very helpful throughout the competition, Thank you!</p>",
      "rawMarkdown": "Just wanted to say that I find the host's involvement very helpful throughout the competition, Thank you!",
      "votes": null
    },
    {
      "id": "1365480",
      "postDate": "06/25/2021 19:08:54",
      "content": "<p>The number of leapMilliSeconds(<a href=\"https://en.wikipedia.org/wiki/Leap_second\" target=\"_blank\">https://en.wikipedia.org/wiki/Leap_second</a>) keeps changing with time. Hence we need to know number of leapMilliSecondsAsOfToday (it is 18*1000 milliseconds for 2020 and 2021)</p>",
      "rawMarkdown": "The number of leapMilliSeconds(https://en.wikipedia.org/wiki/Leap_second) keeps changing with time. Hence we need to know number of leapMilliSecondsAsOfToday (it is 18*1000 milliseconds for 2020 and 2021)",
      "votes": null
    },
    {
      "id": "1365494",
      "postDate": "06/25/2021 19:23:00",
      "content": "<p><a href=\"https://www.kaggle.com/gymf123\" target=\"_blank\">@gymf123</a> this is the corrected equation:<br>\nmillisElapsedFromUTCEpcohToGPSEpoch = (datetime(1980, 1, 6, tzinfo=timezone.utc) - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()*1000</p>\n<p><strong>millisSinceGPSEpoch = utcTimeMillis - millisElapsedFromUTCEpcohToGPSEpoch  + leapMilliSecondsAsOfToday</strong></p>\n<p>In numbers:<br>\n<strong>millisSinceGPSEpoch = utcTimeMillis - 315964800000.0 + 18000</strong></p>",
      "rawMarkdown": "gymf123 this is the corrected equation:\nmillisElapsedFromUTCEpcohToGPSEpoch = (datetime(1980, 1, 6, tzinfo=timezone.utc) - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()*1000\n\n**millisSinceGPSEpoch = utcTimeMillis - millisElapsedFromUTCEpcohToGPSEpoch  + leapMilliSecondsAsOfToday**\n\nIn numbers:\n**millisSinceGPSEpoch = utcTimeMillis - 315964800000.0 + 18000**",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1354534,
      "author_name": "gymf123",
      "author_url": "",
      "post_date": "06/17/2021 16:36:26",
      "content": "<p>Hi Arjun, your formula looks good to me, except for convertToMillis(datetime(1980, 1, 6) - datetime(1970, 1, 1)).</p>",
      "votes": null,
      "replies": [
        {
          "id": 1359097,
          "author_name": "avivlevi815",
          "author_url": "",
          "post_date": "06/21/2021 04:43:25",
          "content": "<p>Just wanted to say that I find the host's involvement very helpful throughout the competition, Thank you!</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1356310,
      "author_name": "alpinestranger",
      "author_url": "",
      "post_date": "06/18/2021 22:46:57",
      "content": "<p>Hi, I had the same problem - not very sure about <code>+leapMilliSecondsAsOfToday</code> - not getting what \"today\" has got to do with it? I'm a bit confused sorry.</p>\n<p>Empirically, it seems utcTimeMillis - millisSinceGPSEpoch = 315964782000? Can someone please confirm this?</p>",
      "votes": null,
      "replies": [
        {
          "id": 1365480,
          "author_name": "arjunrdeshmukh",
          "author_url": "",
          "post_date": "06/25/2021 19:08:54",
          "content": "<p>The number of leapMilliSeconds(<a href=\"https://en.wikipedia.org/wiki/Leap_second\" target=\"_blank\">https://en.wikipedia.org/wiki/Leap_second</a>) keeps changing with time. Hence we need to know number of leapMilliSecondsAsOfToday (it is 18*1000 milliseconds for 2020 and 2021)</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 1365494,
      "author_name": "arjunrdeshmukh",
      "author_url": "",
      "post_date": "06/25/2021 19:23:00",
      "content": "<p><a href=\"https://www.kaggle.com/gymf123\" target=\"_blank\">@gymf123</a> this is the corrected equation:<br>\nmillisElapsedFromUTCEpcohToGPSEpoch = (datetime(1980, 1, 6, tzinfo=timezone.utc) - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()*1000</p>\n<p><strong>millisSinceGPSEpoch = utcTimeMillis - millisElapsedFromUTCEpcohToGPSEpoch  + leapMilliSecondsAsOfToday</strong></p>\n<p>In numbers:<br>\n<strong>millisSinceGPSEpoch = utcTimeMillis - 315964800000.0 + 18000</strong></p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1344270": "I would like sync millisSinceGPSEpoch with utcTimeMillis in order to use IMU and Magnetometer data. millisSinceGPSEpoch represents number of milliseconds elapsed after since the GPS epoch (1980/1/6 midnight UTC) and is expressed in GPS time. utcTimeMillis represents milliseconds elapsed after UTC epoch (1970/1/1), represented in UTC time? (are these definitions correct)\n\nIs the following conversion from utcTimeMillis to millisSinceGPSEpoch correct:\nmillisSinceGPSEpoch = utcTimeMillis - convertToMillis(datetime(1980, 1, 6) - datetime(1980, 1, 6))  + leapMilliSecondsAsOfToday",
    "1354534": "Hi Arjun, your formula looks good to me, except for convertToMillis(datetime(1980, 1, 6) - datetime(1970, 1, 1)).",
    "1356310": "Hi, I had the same problem - not very sure about `+leapMilliSecondsAsOfToday` - not getting what \"today\" has got to do with it? I'm a bit confused sorry.\n\nEmpirically, it seems utcTimeMillis - millisSinceGPSEpoch = 315964782000? Can someone please confirm this?",
    "1359097": "Just wanted to say that I find the host's involvement very helpful throughout the competition, Thank you!",
    "1365480": "The number of leapMilliSeconds(https://en.wikipedia.org/wiki/Leap_second) keeps changing with time. Hence we need to know number of leapMilliSecondsAsOfToday (it is 18*1000 milliseconds for 2020 and 2021)",
    "1365494": "gymf123 this is the corrected equation:\nmillisElapsedFromUTCEpcohToGPSEpoch = (datetime(1980, 1, 6, tzinfo=timezone.utc) - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()*1000\n\n**millisSinceGPSEpoch = utcTimeMillis - millisElapsedFromUTCEpcohToGPSEpoch  + leapMilliSecondsAsOfToday**\n\nIn numbers:\n**millisSinceGPSEpoch = utcTimeMillis - 315964800000.0 + 18000**"
  },
  "source": "meta"
}