Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DATE$ function
#51
(10-26-2023, 12:27 AM)Kernelpanic Wrote: Reminds me of local forums where people kept popping up and wanting advice on how to turn off or delete this and that in order to save storage space - for hard drives with a terabyte or more.

These people almost always showed up after days or a few weeks with a cry for help: "My system suddenly crashed. I do not know why. How can I save my data (No backup, of course. They are experts!)?".

The world is full of experts, and they are not getting any less.  Tongue

An oldy, but for what it's worth:  x denotes the unknown; Spurt is a drip under pressure.
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, W.A.) Big Grin
Please visit my Website at: http://oldendayskids.blogspot.com/
Reply
#52
Maximum int64 seconds in years:

Code: (Select All)
Dim y As _Integer64
Dim s As _Integer64
Dim d As _Integer64

s = 86400 ' seconds
d = 365 ' days

Dim t As _Integer64
y = 292277026596 ' years
t = y * s * d
Print "Maxint="; t
Print "Overflow Maxint= "; t * 2
Reply
#53
(10-27-2023, 11:04 PM)eoredson Wrote: Maximum int64 seconds in years:

Code: (Select All)
Dim y As _Integer64
Dim s As _Integer64
Dim d As _Integer64

s = 86400 ' seconds
d = 365 ' days

Dim t As _Integer64
y = 292277026596 ' years
t = y * s * d
Print "Maxint="; t
Print "Overflow Maxint= "; t * 2

Your number is wrong.
292,277,026,596  <-- Your number of years.
292,471,208,677  <-- Max number of years, stored as seconds, without overflowing.

Code: (Select All)
Screen _NewImage(800, 600, 32)

Dim maxInt64 As _Integer64
maxInt64 = 9223372036854775807

Dim y As _Integer64
Dim s As _Integer64
Dim d As _Integer64

s = 86400 ' seconds
d = 365 ' days

Dim t As _Integer64
y = 292277026596 ' years
t = y * s * d
Print "Maxint="; t
Print "Overflow Maxint= "; t * 2

Print
Print "Correct Values"
Print Int(maxInt64 / (86400&& * 365&&)) '60 seconds in 60 minutes in 24 hours in 365 days
Print maxInt64; " <== Max INT64"
Print 292471208677&& * 86400&& * 365&&; " <== Max number of years in seconds, you can store in an INT64"

This is a simple case of division.  Why's it so hard to get the correct answer here?  Am I missing something?
Reply
#54
Quote:This is a simple case of division.  Why's it so hard to get the correct answer here?  Am I missing something?
Except for leap years I just know this is what I got from Wikipedia.

https://en.wikipedia.org/wiki/Time_forma...77,026,596

Erik.
Reply
#55
(10-27-2023, 11:29 PM)eoredson Wrote:
Quote:This is a simple case of division.  Why's it so hard to get the correct answer here?  Am I missing something?
Except for leap years I just know this is what I got from Wikipedia.

https://en.wikipedia.org/wiki/Time_forma...77,026,596

Erik.

So you know where that number came from -- it has nothing to do with whatever you were trying to accomplish and show with your example:

Code: (Select All)
Screen _NewImage(800, 600, 32)
Dim maxInt64 As _Integer64
maxInt64 = 9223372036854775807&&
Print maxInt64; " <== Max INT64"
Print Int(maxInt64 / (86400&& * 365.2425##)); " <== Max number of years." '60 seconds in 60 minutes in 24 hours in 365.2425 days
Print 292277024626 + 1970; " <== Unix time started in 1970, so add 1970"
Print 292277026596; " <== The time from Wiki."
Reply
#56
Ok, that works. Thanks.

Erik.
Reply




Users browsing this thread: 23 Guest(s)