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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:11:32+00:00 2026-06-14T00:11:32+00:00

One of my classes Event will have an instance field which is called timeStamp

  • 0

One of my classes Event will have an instance field which is called timeStamp. Now, I have another class which will set the timeStamp according to some other algorithm which is not really relevant here.

My question is what type should I store this timeStamp in? From what I’ve researched so far I have the impression that it should be calculated in milliseconds and thus store it in a double perhaps.

Basically the Clock class I have simulates time in the following format : hh:mm:ss. However, since it’s a discrete event simulation that I’m developing it jumps from event to event, which it determines by timeStamp value i.e. each event object has a timeStamp value which is stored in a PrioityQueue. So I thought about storing the timeStamp in the same format as the Clock , which I guess would involve me creating a new class TimeStamp that then becomes the type of the timestamp. Or should I just make the clock simulate time in milliseconds?

What are your thoughts on this? I’m not sure on the most efficient/clean way to implement this.

  • 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-14T00:11:33+00:00Added an answer on June 14, 2026 at 12:11 am

    When a date is stored as milliseconds since the epoch, you should use a long.

    There’s no need for a double, since you’re not interested in fractions of a millisecond.

    You can’t use an int because the maximum int value is only large enough to represent approximately one month in millis.

    You can get such a value like this:

    long millisSinceEpoch = Calendar.getInstance().getTimeInMillis();

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

Sidebar

Related Questions

I have a field for addedBy in one of my classes. I've set up
I have two classes one of which inherits from the other. Im trying to
I have three classes, one class loads in a configuration file into memory for
I have a button in one of my classes that i create it with
All -- I have these two methods in one of my classes: public static
I have a Visual Studio C++ solution with 3 projects: one contains all classes
Essentially, I am just creating two classes where one class, in this case class
I've only found rather complicated answers involving classes, event handlers and callbacks (which seem
I have an interface called IDataIO: public interface IDataIO { event DataReceivedEvent DataReceived; //.....more
I have a set of classes that are used multiple times on a page

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.