Case closed?

iArnold

Member
Joined
Mar 18, 2011
Messages
63
Calculating the "exact duration" of 2 months is very hard to impossible, as months do not have the same amount of seconds. For example: 31 dec + 2 months... is 31 feb. Also here and there extra seconds are added, thus you get times like: 23:59:62 (62 seconds, when 3 additional seconds are added). You can do compromises, like using days in the range 1-28 and only change the month.

Some more languages:

# JAVA
Code:
org.joda.time.Seconds.secondBetween(now, intwo)
# PHP
PHP:
use Carbon\Carbon;

$now = Carbon::now();
$intwo = $now->copy()->addMonths(2);
$seconds = $now->diffInSeconds($intwo);
# PERL
Code:
use Time::Piece;
use Time::Seconds;

my $now = localtime;
my $intwo = $now + 2 * ONE_MONTH;
my $seconds = ($intwo - $now)->seconds;
And you are even forgetting about the messing with time when switching from 'wintertime' to 'summertime' and back.
 

Djoga'Ro

moonstruck
Joined
Apr 3, 2016
Messages
1,019
If you want exact calculation, express month in x amount of seconds - a twelfth of a year. Anything else is up to you to define and with it the difficulty in doing calculations with that stuff.
 

FBnil

Waiting to Champion the Pyra to the World...
Joined
Dec 14, 2012
Messages
2,888
Location
Yurp
If you want exact calculation, express month in x amount of seconds - a twelfth of a year. Anything else is up to you to define and with it the difficulty in doing calculations with that stuff.
# Dude, even: date --date='2012-01-31 09:00 next Month'
# prints: Fri Mar 2 09:00:00 CET 2012
# So it also sums 31 days.


M' => 60*60*24*31, # HERE BE BUGS for month that do not have 31 days.
'O' => 2629743, # 30.44 days (real month, but hours shift) @Your suggestion
 

ClockworkCoder

Chaotic Neutral
Joined
Jan 21, 2016
Messages
1,226
Location
Menzoberranzan
I actually lol'ed! (Does anybody ever do that when they write "lol")

I love how we are set on calculating the 'release date' of the Pyra to the nearest picosecond :)

Fwiw, we probably need a less relativist means of measurement. Or an announcement from The Dragon.
 

spud42

Very Active Member
Joined
Aug 22, 2009
Messages
618
Age
58
Location
Brisbane,Australia.
i love the ambiguity of "2 Months" trade mark.....
however has it ever been established the the aforesaid mentioned 2 months are indeed actually consecutive? which then opens another can of worms in such that are they indeed from the same Annual period?
 

klapse

Central Scrutinizer
Joined
Aug 30, 2012
Messages
1,932
Location
Germany
Very nice to see the unboxing video. Always nice to see the care ED takes even when making a youtube Wideo.

Very happy to see how well thought-out the case is, without difficult assembly/disassembly. Just great.
 

Djoga'Ro

moonstruck
Joined
Apr 3, 2016
Messages
1,019
'O' => 2629743, # 30.44 days (real month, but hours shift) @Your suggestion
So? It's precise and consistent. You could then go and say: Two months from now is the same time of day as it is now on the day that contains the point in time, that is two precise months from now.
 

Dark Pulse

Retreaux
Joined
Jun 12, 2013
Messages
189
i love the ambiguity of "2 Months" trade mark.....
however has it ever been established the the aforesaid mentioned 2 months are indeed actually consecutive?
They are - first and last come in consecutive order.
 

levi

Still fresh, damnit!
Joined
Oct 6, 2008
Messages
11,597
Location
Somewhere off the coast of the EU
i love the ambiguity of "2 Months" trade mark.....
however has it ever been established the the aforesaid mentioned 2 months are indeed actually consecutive? which then opens another can of worms in such that are they indeed from the same Annual period?
IIRC the offical rendering of the 2 month (tm) trademark indicated a period that can be any length of time, but most likely at least two months. So in that sense, all of the code snippets in this thread have been equally valid ;)
 

rygD

Nihilistic Mystic
Joined
Feb 28, 2014
Messages
7,401
Location
Everywhere
My position is that you can not measure a MOON measurement (month) with a SOLAR measurement (year).
Sure you can, they just don't like up perfectly. Kinda like other measurement systems we use. I usually measure things in cubits and finger widths because it is easy.
 
Top