phpWebLog - web news management with adolescent sexist humor
find
story index | search | archive | submit story | downloads | stats | contact
Topics
  • General (909)
  • Announcements (20)
  • Development (518)
  • Mods & Hacks (32)


  • phpWebLog
  • Latest Release - 0.5.3 (BETA)
  • Latest Stable - 0.5.2
  • ChangeLog
  • TODO / Roadmap
  • BUGS

    CVS WEB

  • New XL fork 0.5.2
  • Unstable branch 0.5.3

  • For development discussions and for general support, join the phpWebLog mailing list

    phpWebLog needs active developers to help fix bugs. If you are interested, send me your SourceForge login information for CVS access.


    Last 5 Comments
  • Where can I modify the style of bottom navigation? (Ken Farmer)
  • Great News for PHP Programmers.... (Nekrataal)
  • Unable to update URL block content. (Nekrataal)
  • Comment management (Nekrataal)
  • phpweblog woes (Nekrataal)


  • Cross platform date function fix - General
    Posted by mocha (Thursday October 05 2000 @ 11:57PM EDT) views: 328
    after submitting my previous post regarding why the date we set to 2036-11-12 and wrong time for submitted stories and comments, i dug through the codes and found that Jason did the standard thing and used mysql's NOW() function.
    Apparantly on 64-bit system w/o native threads, mysql uses MIT-threads. Consequently the time() returned is incorrect in most circumstances when you use mysql's NOW() function.
    In order to fix this problem, i used PHP's
    date("Y-m-d G:i:s")
    in place of NOW() for all occurances of NOW() in preview.php and include/common.inc.php.
    Jason, if you would like the diff for those files, please let me know.
    Here is an output of a select statement to demonstrate what i'm talking about:

    mysql> select Rid,Timestamp,Birthstamp FROM T_Stories;
    +------------------+----------------+---------------------+
    | Rid | Timestamp | Birthstamp |
    +------------------+----------------+---------------------+
    | 00/10/05/5569922 | 20361112031114 | 2136-11-11 10:14:25 |
    | 00/10/05/3425315 | 20361112005749 | 2136-11-11 12:25:21 |
    | 00/10/05/5725052 | 20361112030000 | 2136-11-12 02:57:01 |
    | 00/10/05/7952565 | 20361112024756 | 2136-11-11 13:40:48 |
    +------------------+----------------+---------------------+
    4 rows in set (0.00 sec)

    mysql> select now();
    +---------------------+
    | now() |
    +---------------------+
    | 2136-11-12 05:21:55 |
    +---------------------+
    1 row in set (0.00 sec)

    Now all I need to do is go back and update the fields and correct the Timestamp and Birthstamp for relevant tables. Jason, how do I turn the Rid field into a timestamp? The date is obviously there already, however the time.microsecs is in a weird format. Any help is appreciated cause those records currently always stay above all the rest in the story page.

    < bug in include/common.inc.php | Summary not working >

    By jason (Friday October 06 2000 @ 11:37AM EDT)
    Ahh. I did not know this..
    To generated a Rid, use the function F_getRid();
    [ reply | parent ]
    By mocha (Friday October 06 2000 @ 12:39PM EDT)
    further looking into the db schema, you used 'timestamp' for some of the fields. even with the fix i sent previous, timestamp fields will use the current time from mysql which would be yield an incorrect value because of the bug in mysql on 64-bit systems. there are two resolutions to this problem:
    1. change the db schema for the fields that use timestamp to a datetime field and change SELECT and INSERT functions in phpweblog to update those fields (which were automatic before).
    2. i submitted a patch to MySQL to fix the timestamp and NOW() function. basically the bug in mysql is in mit-pthreads. in the file:
    mit-pthreads/gen/ctime.c
    the function detzcode() should be defined and return as an INT instead of a LONG. the bug works fine if you are in a positive GMT timezone on a 64-bit architecture, because it's stuffing the GMT offset into a 64-bit long rather than a 32-bit int. however, if you are in a negative GMT timezone, it turns the negative offset into one huge positive offset. here is the fix for mysql 3.23.25-beta (should work with previous versions as well):
    ---cut---
    # diff mit-pthreads/gen/ctime.c.orig mit-pthreads/gen/ctime.c
    132c132
    static int detzcode __P_((const char *));
    178c178
    static int detzcode(const char * codep)
    180c180
    int result;
    ---cut---
    MySQL should have this fix in their next beta or release. i guess we could stick with using the timestamp fields in our tables.
    [ reply | parent ]
    Post a Comment
    Name:
    Email:
    URL:
      Remember my information (uses cookies)
      I would rather be anonymous
    Comment:
    * Your email will not be made public.
    Save As:
    SourceForge
    SourceForge is providing us a mailing list , documentation and a CVS tree.

    SourceForge Logo


    PHP.net
  • php|cruise: The World's First Ever PHP-only Cruise
  • PHP Usage Survey Results
  • PHP Manual CHM Edition - 12th build
  • International PHP Conference 2003 program online
  • Server Central Donates Server
  • European Open Source Development Threatened!
  • php{con west is announced
  • PHP 4.3.3 released!
  • Active Awards 2003 Winners
  • PHP.net news history

  • PHPBuilder
  • On User-Defined Timezones in PHP
  • Dreamweaver MX 2004
  • Using PEAR's HTML_Table Class
  • An introduction to the ADOdb class library, Part 2
  • An introduction to the ADOdb class library for PHP
  • Manually Expiring Web Pages
  • Regression Testing With JMeter
  • Advanced Image Editing Under the GD Library
  • The Benefits of Using Objects with Databases
  • Interfacing with COM objects under Windows


  • phpWebLog: A PHP News and Content Management System
    Copyright (C) 2000-2002, Jason Hines / Eye Integrated Communications