Hi,

My newly upgraded system intermittently time-stamps new comments as 1970 00:00! I've taken a look in the database and these "1970" comments have "0" in their "timestamp" field in the "comments" table. Does anyone know what's going on? This problem is intermittent... at the moment it's happening to about 1 in every 3 comments.

I upgraded from Drupal-4.6.4 to Drupal-4.7-CVS (I downloaded the CVS last night so it should be running code that's a day more mature than beta-3).

My server is running MySQL 4.1.14-standard and PHP-4.4.1 and I'm using the UTF8_general_ci character set.

Any help would be greatly received!

Thanks,
Jack

Comments

gateone’s picture

Hi,

What you experience is not so unusual. Unix/Linux-machines calculate time in a thing called "UNIX Timestamp" or "UNIX time". This is a time coordinate kind of system, it calculates in seconds the time from January 1st, 1970. You can read the precise definitions on Wikipedia.

So what has happened there: simply, it appears that no time stamp is recorded by whatever reason in the database, when a comment is left. So its value is 0 which equals the beginning of the UNIX Time scope, January 1st, 1970. Since you downloaded a CVS-version of Drupal I suppose that this is due to the fact that some bug-fixing is going on in this particular part right now!

dan_aka_jack’s picture

Thanks for the reply!

OK, I've just hacked together a tiny little fix in the comment.module. On line 633 (in the comment_save function), just before the db_query("UPDATE {comments} SET ...") line I've put in this little fix:

        if (!$edit['timestamp']) {
          $edit['timestamp']=time();
        }

So far, it seems to work. Does anyone have any better suggestions or any reasons why this fix my break things?

chx’s picture

But instead I leave it here to testify about what's wrong. A) you used too many exclamation marks b) This is an issue so why not using the issue tracker? c) maybe because you would have found out that this is a well known and worked on problem?
--
Read my developer blog on Drupal4hu. | The news is Now Public

--
Drupal development: making the world better, one patch at a time. | A bedroom without a teddy is like a face without a smile.

dan_aka_jack’s picture

Um, thanks for your reply chx.

I did spend some time searching both the forums and the issue tracker. Searching for "comment timestamp" didn't bring up any helpful hits. I didn't post it in the issue tracker because, to be honest, I didn't think it was a Drupal issue as such. Instead I thought it had to do either with my upgrade procedure or with something bad that I did whilst setting up my server.

I've now looked a bit closer at the issue tracker and I assume you are referring to this issue titled "comment updates shouldn't touch things that aren't specified"? I had a quick skim-read and couldn't find any information about how to fix the problem. Please could you point me in the right direction? (I'm not gonna apologise for only skim-reading... I don't really have time to look closely right now)

And, if I may be so bold, please may I suggest that you consider being nicer to people you've never met before? You make some utterly valid points but, in my humble opinion, you make them in a slightly brash way and you might get your opinion across more efficiently if you were a little kinder. Maybe I'm wrongly interpreting your tone of voice; if so I apologise.

Peace,
Jack.

chx’s picture

If this would have been in the issue queue, I could easily mark it as such. Second, never forget that people on the Internet are more harsh but again -- accept my apologies.
--
Read my developer blog on Drupal4hu. | The news is Now Public

--
Drupal development: making the world better, one patch at a time. | A bedroom without a teddy is like a face without a smile.

dan_aka_jack’s picture

Hi chx,

No problem. Thanks loads for your reply. In future I'll make sure I spend more time searching the forums and the bugs section before posting.

Thanks again,
Jack.

kenorb’s picture

I've the same problem on 6.9.
My all recent comments are dated 1970, by datetime is set as correct. WTF?!

ailgm’s picture

Can anyone suggest a solution?

75300’s picture

It seems that this problem still exists at numerous websites (including my own)...

75300’s picture

For me that was a bug in "Submitted by" module which caused the problem. Upgraded this module to a newer version and it's OK now.

http://drupal.org/node/432966