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

  • Home
  • SEARCH
  • 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 7782933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:41:38+00:00 2026-06-01T19:41:38+00:00

I have a loop and in every loop I get the current seconds the

  • 0

I have a loop and in every loop I get the current seconds the application has been running for I then want to convert this time into how many, Days, Hours and Seconds that the seconds calculate to but not ‘real time’ I need to be able to customize how many seconds are in a day, I have tried examples on SO and the web but nothing seems to be out there for this. I have some defines

#define DAY             1200
#define HOUR            DAY / 24
#define MINUTE          HOUR / 60
#define SECOND          MINUTE / 60

So in my define a day would last for 1200 seconds. I have then been trying to convert elapsed seconds into ‘my’ seconds

seconds_passed = fmodf(SECOND, (float)(GetTicks() / 1000));

Which returns what SECOND equals (0.013889) but then every loop is the same, it never changes I was thinking I would just be able to convert for example: 1real second into 1.25fake seconds then

Minute = (seconds_passed / MINUTE);
seconds_passed = fmodf(seconds_passed, MINUTE);

work out how many (fake)minutes, (fake)hours and (fake)days have elapsed since the application started.

Hope that makes sense, thank you for your time.

  • 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-01T19:41:40+00:00Added an answer on June 1, 2026 at 7:41 pm

    Since you want to customise how many seconds are in a day, all you’re really doing is changing the ratio of 1 second : 1 second.

    For instance, if you did was 1200 seconds in a day your ratio is:
    1:72
    that is, for every 1 second that passes in your day, it is the equivilent of 72 real seconds.

    So yes basically all you need to do in your program is find the ratio of 1 second to 1 second, times your elapsed seconds by that to get the ‘fake’ seconds, and then use that value…
    The code may look something like this:

    // get the ratio second:fake_second
    #define REAL_DAY_SECONDS 86400
    int ratio = REAL_DAY_SECONDS / DAY;
    
    fake_to_real = fake_second*ratio;
    real_to_fake = real_second/ratio;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the code below and I want to loop this every 5 seconds.
I have a loop which basically calls this every few seconds (after the timeout):
I have this PHP code in a loop for every post on the admin
I currently have a class that sets the current time when an object has
I have a recordset loop that creates a table, and every 9 items it
I have loop and each iteration of Hash looks like this: [1, {:clid=>1, :nvz=>4,
I have a file. I read the size of file. Then I loop reading
i have this littel problem with a test app. Current look: <form> <span>1:Question goes
I have this loop in PHP that echoes out a table of results, <table
I have loop designed to validate the user input on a question, it was

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.