Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9060529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:15:11+00:00 2026-06-16T15:15:11+00:00

The code is from this page: https://github.com/reddit/reddit/blob/master/r2/r2/lib/db/_sorts.pyx Here is the code snippet: cpdef double

  • 0

The code is from this page:
https://github.com/reddit/reddit/blob/master/r2/r2/lib/db/_sorts.pyx

Here is the code snippet:

cpdef double epoch_seconds(date):
"""Returns the number of seconds from the epoch to date. Should
   match the number returned by the equivalent function in
   postgres."""
td = date - epoch
return td.days * 86400 + td.seconds + (float(td.microseconds) / 1000000)

I think td.days * 86400 should be equal to td.seconds as well as (float(td.microseconds) / 1000000), I was wondering why didn’t they simply make td.seconds multiply 3?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T15:15:12+00:00Added an answer on June 16, 2026 at 3:15 pm

    Your assumptions are wrong and that is why this seams weird. td.days contains the number of days since the epoch as you correctly assumed, but td.seconds and td.microseconds contains the number of seconds since the start of the day and the number of microseconds since the start of the second respectively. Thus the return value becomes the number of seconds since the epoch with microseconds as the part after the comma.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was looking through some code from a firefox extension (here: https://github.com/mozilla/prospector/blob/master/oneLiner/bootstrap.js#L34 ) and
Below example is taken from this documentation page: https://github.com/activescaffold/active_scaffold/wiki/Chaining-Form-Fields [Example start] You can set
I'm following along with this tutorial (in french only) https://github.com/k33g/articles/blob/master/2011-08-14-BB-VIEWS.md which uses underscore templates
Does anybody know why the same code from this page http://emacsformacosx.com/ would not render
Lets say there's a file that lives at the github repo: https://github.com/someguy/brilliant/blob/master/somefile.txt I'm trying
reading this https://developers.google.com/in-app-payments/docs/tutorial Quoted from the above page: Because you sign the JWT using
Hi I found the following code from this page JQuery UI DatePicker using 2
i got a jquery code from this link (end of page): How to scroll
how can i write this code from aspx page in code behind? <a href=skype:MySkype?call><img
hello i am using this Page.ClientScript.RegisterStartupScript() to call a javascript function from vb code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.