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 9168699
In Process

The Archive Base Latest Questions

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

I seem to have found a bug in Ruby, but I’m not sure so

  • 0

I seem to have found a bug in Ruby, but I’m not sure so I’m posting it here.

I have a Rails app that fetches the latest objects after a given timestamp, which is the timestamp of the last object being shown on the page.

But for some reason it was always returning the last object duplicated. After a while, we decided to convert it to epoch, but it didn’t work.

After trying to find where the issue might is, I’ve come up with the given code:

require 'date'
DateTime.strptime("1358895408.915", "%s").strftime("%s")
# => "1358895408"

Isn’t this supposed to work? Am I missing something? How can I safely parse time and keep the milliseconds intact?

  • 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-17T15:41:17+00:00Added an answer on June 17, 2026 at 3:41 pm

    (Edited under suggestion following Andrew Marshall)

    Use Time.at. That will preserve milliseconds. It takes a numeric instead of a string.

    Time.at(BigDecimal.new('1358895408.915'))
    .strftime("%s.%L")
    # => "1358895408.915"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I seem to have found a bug in jQuery UI that duplicates dragged elements
I have done a load of searching but haven't found anything. There seem to
I seem to have broken validates_confirmation_of in my rails app. My model looks like
I seem to have found a weird edge case where it seems that a
I think I may have found a bug in WebMatrix's PageData, but I am
I seem to have looked through many solution on here and the web and
I'm seriously stuck here with something obvious. I have an application that communicates with
I found a threadpool which doesn't seem to be in boost yet, but I
Hi all, I seem to have found a discrepancy when testing ASP.NET applications locally
I've spent a few minutes searching on Google and have not found anything related

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.