UNIX time just rolled over

Discussion of non-phpBB related topics with other phpBB.com users.
Forum rules
General Discussion is a bonus forum for discussion of non-phpBB related topics with other phpBB.com users. All site rules apply.
pixel001
Registered User
Posts: 100
Joined: Thu Aug 23, 2007 11:38 am

Re: UNIX time just rolled over

Post by pixel001 » Thu Oct 02, 2008 9:13 am

i wonder how come the guys who came up with this Unix-POSIX time never realised lots of people actually are born before 1-1-1970. So how do you even record that ? i figure i'll just have to handle it using a mysql date field. or maybe there's a nifty php library included in the phpbb3 codebase?

Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 25228
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: UNIX time just rolled over

Post by Paul » Thu Oct 02, 2008 11:07 am

pixel001 wrote:i wonder how come the guys who came up with this Unix-POSIX time never realised lots of people actually are born before 1-1-1970. So how do you even record that ? i figure i'll just have to handle it using a mysql date field. or maybe there's a nifty php library included in the phpbb3 codebase?
It just goes negative:

Code: Select all

dwerg:~# cat 1970.php
<?php
echo strtotime("1 January 1969"), "\n";
?>
dwerg:~# php 1970.php
-31539600
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development

User avatar
ameeck
Former Team Member
Posts: 6559
Joined: Mon Mar 21, 2005 6:57 pm

Re: UNIX time just rolled over

Post by ameeck » Thu Oct 02, 2008 3:19 pm

Also I don't see why you would use a timestamp for a DOB. Timestamps are precise to a second and I doubt you'll be entering your birthday with this precision. A simple date would probably server much better.

User avatar
Dog Cow
Registered User
Posts: 2494
Joined: Fri Jan 28, 2005 12:14 am
Contact:

Re: UNIX time just rolled over

Post by Dog Cow » Thu Oct 02, 2008 3:36 pm

I believe the reason for that is because not all RDBMS support date fields.

User avatar
ameeck
Former Team Member
Posts: 6559
Joined: Mon Mar 21, 2005 6:57 pm

Re: UNIX time just rolled over

Post by ameeck » Thu Oct 02, 2008 3:44 pm

Well, the timestamp is also usually defines as INT(11), so there isn't any special datatype. An analogy to this can be having your own dat format, e.g. 2008-04-22 and saving it as a VARCHAR.

User avatar
Dog Cow
Registered User
Posts: 2494
Joined: Fri Jan 28, 2005 12:14 am
Contact:

Re: UNIX time just rolled over

Post by Dog Cow » Thu Oct 02, 2008 5:50 pm

Ok, I understand what you mean now. The problem with VARCHAR versus MySQL's date column type is that the VARCHAR is harder to do calculations on, especially with showing each birthday such as on the index page. That is, it's not exactly the best tool for the job.

User avatar
ameeck
Former Team Member
Posts: 6559
Joined: Mon Mar 21, 2005 6:57 pm

Re: UNIX time just rolled over

Post by ameeck » Thu Oct 02, 2008 6:08 pm

Yes, you're completely right with the collumn types inteded to be used for storing dates in MySQL.

I was trying to address the fact, that you will have a hard time finding identical data types for storing dates across different DBMSs, so storing them as strings or integers in case of timestamps is more of a universal solution.

I think we know what the other meant, no more discussion needed on this I think :)

As for the timestamp Y2038 issue, I really do think computer development will be making great leaps and this will eventually not become a problem. Just look back 30 years backward instead of forward. The oldest computer I have is a 86' Toshiba laptop (that making it older than me) which ran on two floppy disks, HDDs being left for future times :) I think today's computers will be such artifacts by that time.

User avatar
god0fgod
Registered User
Posts: 227
Joined: Wed May 30, 2007 5:25 pm
Contact:

Re: UNIX time just rolled over

Post by god0fgod » Fri Oct 03, 2008 2:27 pm

Use 64 bits? Wouldn't that be an easy solution?

Pezzoni
Registered User
Posts: 706
Joined: Sat Nov 16, 2002 8:25 pm
Contact:

Re: UNIX time just rolled over

Post by Pezzoni » Fri Oct 03, 2008 3:04 pm

I'd like to thank whoever necro'd this for confusing me massively. Having just read the topic title, I was generating timestamps for a month ago so I could test a script I was working on. They all started with the aforementioned '12', so I spent a fair few minutes swearing at PHP / my Maths skills before I realised this topic was from January :oops:

nickaknudson
Registered User
Posts: 0
Joined: Sun Oct 12, 2008 10:41 pm

Re: UNIX time just rolled over

Post by nickaknudson » Sun Oct 12, 2008 10:45 pm

remember that the UNIX time stamp is a signed integer meaning it can go forward and backwards from 1970... I think it goes back to some time in 1901 which should be long enough back to register everyone's birthday

User avatar
Tripp
Former Team Member
Posts: 1358
Joined: Sun May 20, 2007 5:14 am
Location: G'boro, North Carolina
Name: Tripp
Contact:

Re: UNIX time just rolled over

Post by Tripp » Mon Oct 13, 2008 2:20 am

god0fgod wrote:Use 64 bits? Wouldn't that be an easy solution?
Like previously posted, not everyone upgrades. I had to work on a friends computer and it had like a 600 Mhz processor and like a 4 GB HDD. REALLY OLD, point then and now is, not everyone upgrades. I know people who still run Windows 98. So...it's not that easy.

But on the other hand, also like previously said, by the time the bug occurs...I doubt it will matter because computers advance so much in just a few years, 30 years from now? I think we'll be worrying about worse problems then UNIX time. :lol:

User avatar
god0fgod
Registered User
Posts: 227
Joined: Wed May 30, 2007 5:25 pm
Contact:

Re: UNIX time just rolled over

Post by god0fgod » Mon Oct 13, 2008 1:53 pm

Yes, your last point says it all.

User avatar
Nicholas the Italian
Registered User
Posts: 170
Joined: Tue Nov 21, 2006 5:18 pm

Re: UNIX time just rolled over

Post by Nicholas the Italian » Mon Oct 13, 2008 3:27 pm

Well, world may end on Dec 21, 2012 so not really an issue. 8-)
Whatever I say, it's not my fault.

User avatar
bonelifer
Community Team Member
Community Team Member
Posts: 3471
Joined: Wed Oct 27, 2004 11:35 pm
Name: William
Contact:

Re: UNIX time just rolled over

Post by bonelifer » Mon Oct 13, 2008 4:27 pm

Jim_UK wrote:
Paul wrote: You mean at Tue Jan 19 04:14:07 2038 :P
As I will be 90 then I shall put worry about that on the back burner. :lol:

Jim
I'll only be 59 then. :P

User avatar
3Di
Former Team Member
Posts: 13901
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: UNIX time just rolled over

Post by 3Di » Mon Oct 13, 2008 4:34 pm

bonelifer wrote:
Jim_UK wrote:
Paul wrote: You mean at Tue Jan 19 04:14:07 2038 :P
As I will be 90 then I shall put worry about that on the back burner. :lol:

Jim
I'll only be 59 then. :P
Life's strange, remember it. 8-) :lol:

Post Reply

Return to “General Discussion”