Title: AuthHelper.get_current_utc_timestamp returns local time labelled as UTC · Issue #139 · apimatic/core-lib-python · GitHub
Open Graph Title: AuthHelper.get_current_utc_timestamp returns local time labelled as UTC · Issue #139 · apimatic/core-lib-python
X Title: AuthHelper.get_current_utc_timestamp returns local time labelled as UTC · Issue #139 · apimatic/core-lib-python
Description: AuthHelper.get_current_utc_timestamp returns the host's local time read as if it were UTC: # apimatic_core/utilities/auth_helper.py @staticmethod def get_current_utc_timestamp(): return calendar.timegm(datetime.now().utctimetuple()) date...
Open Graph Description: AuthHelper.get_current_utc_timestamp returns the host's local time read as if it were UTC: # apimatic_core/utilities/auth_helper.py @staticmethod def get_current_utc_timestamp(): return calendar.ti...
X Description: AuthHelper.get_current_utc_timestamp returns the host's local time read as if it were UTC: # apimatic_core/utilities/auth_helper.py @staticmethod def get_current_utc_timestamp(): return calenda...
Opengraph URL: https://github.com/apimatic/core-lib-python/issues/139
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"AuthHelper.get_current_utc_timestamp returns local time labelled as UTC","articleBody":"`AuthHelper.get_current_utc_timestamp` returns the host's **local** time read as if it were UTC:\n\n```python\n# apimatic_core/utilities/auth_helper.py\n@staticmethod\ndef get_current_utc_timestamp():\n return calendar.timegm(datetime.now().utctimetuple())\n```\n\n`datetime.now()` is naive local time, and `.utctimetuple()` does not convert a naive value — it returns\nthe fields unchanged. `calendar.timegm` then interprets those fields as UTC, so the result is displaced\nfrom the true epoch by the host's UTC offset.\n\n**Why it usually goes unnoticed.** `OAuth2.fetch_token` stamps `expiry` with this same helper, and\n`is_token_expired` compares against it, so a token the SDK fetched and checks inside one process on one\nhost is self-consistent.\n\n**Where it stops being self-consistent** — both are documented, supported paths:\n\n- an `expiry` the caller computes themselves (from `time.time()`, or a value another system stored) is\n compared against a clock offset from it\n- a token restored via `o_auth_token` / `o_auth_token_provider` on a host whose UTC offset differs from\n the one that saved it is judged against the difference between the two\n\nErring early costs a wasted refresh. Erring late hands an expired token to the API and surfaces as a\n`401` the client's own bookkeeping said could not happen.\n\nSuggested fix: `datetime.now(timezone.utc).timestamp()`, or `calendar.timegm(datetime.utcnow().utctimetuple())`.\n\nFound while grounding the APIMatic skills corpus against generated Python SDKs; the corpus currently\nwarns readers not to supply `expiry` themselves because of this.\n","author":{"url":"https://github.com/sohail2721","@type":"Person","name":"sohail2721"},"datePublished":"2026-09-17T04:38:08Z","url":"https://github.com/apimatic/core-lib-python/issues/139"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:fa40223a-7f5b-1b6c-a00d-ac4e6b679144 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A230:2A07F6:1D15600:266230E:6B056924 |
| html-safe-nonce | b7fd008d2a2d2eec01c22f4da952ad450f0b0dd948294271f15b6e0dc070bfa1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMjMwOjJBMDdGNjoxRDE1NjAwOjI2NjIzMEU6NkIwNTY5MjQiLCJ2aXNpdG9yX2lkIjoiMzc4MzI4Njk0NDUxMjE3NDM3MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c2c373a54db644b38bbfc8269a3f084cdb649b892f6da2fa0d9d629ed49be992 |
| hovercard-subject-tag | issue:5482954692 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/apimatic/core-lib-python/139/issue_layout |
| twitter:image | https://opengraph.githubassets.com/699d4e3ce64734e5a338d8595a416fc3466b05133efd439da24579c26dfa77cc/apimatic/core-lib-python/issues/139 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/699d4e3ce64734e5a338d8595a416fc3466b05133efd439da24579c26dfa77cc/apimatic/core-lib-python/issues/139 |
| og:image:alt | AuthHelper.get_current_utc_timestamp returns the host's local time read as if it were UTC: # apimatic_core/utilities/auth_helper.py @staticmethod def get_current_utc_timestamp(): return calendar.ti... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sohail2721 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1be5cc09efdd4833c24a4ffa71d698e3999fa09071e159fe14c2c08e41c98331 |
| turbo-cache-control | no-preview |
| go-import | github.com/apimatic/core-lib-python git https://github.com/apimatic/core-lib-python.git |
| octolytics-dimension-user_id | 8519046 |
| octolytics-dimension-user_login | apimatic |
| octolytics-dimension-repository_id | 520792150 |
| octolytics-dimension-repository_nwo | apimatic/core-lib-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 520792150 |
| octolytics-dimension-repository_network_root_nwo | apimatic/core-lib-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f6d69234e682c947a48074340e69d45d5901de31 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width