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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:51:46+00:00 2026-05-11T11:51:46+00:00

Is there a sensible way to group Long UTC dates by Day? I would

  • 0

Is there a sensible way to group Long UTC dates by Day?

I would Mod them by 86400 but that doesn’t take leap seconds into account.

Does anyone have any other ideas, I’m using java so I could parse them into Date Objects, but I’m a little worried of the performance overhead of using the date class.

Also is there a more efficient way than comparing the year month and day parts of a Date object?

  • 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. 2026-05-11T11:51:46+00:00Added an answer on May 11, 2026 at 11:51 am

    Does your source data definitely include leap seconds to start with? Some APIs do, and some don’t – Joda Time (which I’d recommend over the built-in date/time APIs) doesn’t use leap seconds, for example. The Java date and time APIs ‘sometimes’ do – they support 60 and 61 as values of ‘second in minute’ but support depends on the operating system (see below). If you have some good sample values, I’d check that first if I were you. Obviously just dividing is rather simpler than anything else.

    If you do need to create Date objects (or DateTime in Joda) I would benchmark it before doing anything else. You may well find that the performance is actually perfectly adequate. There’s no point in wasting time optimizing something which is okay for your data. Of course, you’ll need to decide data size you need to support, and how quick it needs to be first 🙂

    Even the java.util.Date support for leap seconds is somewhat indeterminate. From the docs:

    Although the Date class is intended to reflect coordinated universal time (UTC), it may not do so exactly, depending on the host environment of the Java Virtual Machine. Nearly all modern operating systems assume that 1 day = 24 × 60 × 60 = 86400 seconds in all cases. In UTC, however, about once every year or two there is an extra second, called a ‘leap second.’ The leap second is always added as the last second of the day, and always on December 31 or June 30. For example, the last minute of the year 1995 was 61 seconds long, thanks to an added leap second. Most computer clocks are not accurate enough to be able to reflect the leap-second distinction.

    There’s a rather good blog post about the mess with Java and leap seconds which you may want to read too.

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

Sidebar

Related Questions

Is there any sensible way of transforming this: (for ([cos-t (stream-map cos t-range)] [sin-t
Is there a structured language for declaring styles in a sensible way, which can
Is there a sensible, clean way to refer to application resources from static initalizer
Is there some sensible way to have elements with strongly-typed simple-types and also attributes?
Is there a sensible way to stub/mock the results of a call to IDocumentSession.Query()
Is there any other sensible way where I can fire a touch event on
There is a conversion process that is needed when migrating Visual Studio 2005 web
I need a sensible way to draw arbitrary text files into a C# program,
I want to represent a 2D shape in such a way that it can
I'm updating some old old code (that works for now, but is using OpenTransport,

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.