Jump to content

Kinda stuck on time


Fritigern Gothly
 Share

You are about to reply to a thread that has been inactive for 1524 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

So.... I was revisiting a script which I made AGES ago in the hopes that I could fix some of the biggest issues that I kept running into at the time and alsthough I fixed some super big mistakes, there's one thing that I keep getting stuck on. 

I am not good with time-related functions, but one thing that the script is doing is us llGetTime() to retrieve the time that the script has run, then convert that into a human-redable format using the example code from http://lslwiki.digiworldz.com/lslwiki/wakka.php?wakka=llGetWallclock

So far so good, but then ran into the issue that I also want to know how many DAYS the script has run, so I added "days = time / 86400;" which indeed gives me the number of days. HOWEVER, the hours keep counting up and up and up, so I now have a script which tells me it has been running 11 days, 271 hours, 51 minutes and 10 seconds.

And this is where I run into my own limitations, I can not figure out how to change the calculation so that the hours make sense.

Here's the relevant snippet. The resulting values are later used in reporting back the script's uptime. 
 

    timer()
    {
        // time = (integer)llGetTime();    // The actual function, commented out for testing
        time = (86399*17);				   // Test value. Should translate to 16 days, 23 hours, 59 minutes and 59 seconds if I am right.
        days = time / 86400;
        hrs = time / 3600;
        mins = (time % 3600) / 60;
        secs = time % 60; 
    }

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1524 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...