You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Emmanuel Courreges (JIRA)" <ji...@apache.org> on 2012/07/13 10:02:34 UTC

[jira] [Created] (CASSANDRA-4437) cqlsh displays bad timezone for timestamp types

Emmanuel Courreges created CASSANDRA-4437:
---------------------------------------------

             Summary: cqlsh displays bad timezone for timestamp types
                 Key: CASSANDRA-4437
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4437
             Project: Cassandra
          Issue Type: Bug
          Components: Tools
    Affects Versions: 1.1.2
         Environment: Ubuntu 10.04 64bit
            Reporter: Emmanuel Courreges
            Priority: Minor


cqlsh uses the time.localtime(epoch) function in python which converts the time received from thrift into your local timezone but does not fill in the timezone info, so when it is printed with time.strftime, it always appears with an hour in your timezone with +0000 as the timezone which is wrong.


Example:

cqlsh:ecourreges> UPDATE syndic set emails=11, unreadmails=3, nextuid=16, endwnd='2012-07-14 21:15:00+0000', endsub='2012-07-14 21:15:00+0000' where ise='ise1';
cqlsh:ecourreges> select * from syndic;
 ise  | alllastdetails | allmaildetails | emails | endsub                   | endwnd                   | lastdetails | lastnotif | maildetails | nextuid | unreadmails
------+----------------+----------------+--------+--------------------------+--------------------------+-------------+-----------+-------------+---------+-------------
 ise1 |           null |           null |     11 | 2012-07-14 23:15:00+0000 | 2012-07-14 23:15:00+0000 |        null |      null |        null |      16 |           3


The output should be '2012-07-14 21:15:00+0000' or '2012-07-14 23:15:00+0200' but not '2012-07-14 23:15:00+0000' !!!

I see 2 ways of fixing it:
cqlsh line 474: replace timestamp = time.localtime(val) with timestamp = time.gmtime(val)

or handle the timezone properly by using something else than localtime+strftime, but the question is what?


Good luck and keep up the great work!

Regards,
Emmanuel Courrèges.
Alten Consultant for Orange Portal France.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (CASSANDRA-4437) cqlsh displays bad timezone for timestamp types

Posted by "paul cannon (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CASSANDRA-4437?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13451505#comment-13451505 ] 

paul cannon commented on CASSANDRA-4437:
----------------------------------------

Hmm, {{time.strftime()}} should be filling in the local timezone for the {{%z}} directive, so it should be correct as written. And it does work as intended on my Debian and OS X boxes. However, it looks like you're right, it's not behaving correctly in Ubuntu 10.04. Looking deeper, I can find a bunch of OS/Python version pairs where it works correctly, and several where it doesn't. The system libc strftime() appears to work as designed in all cases, so it looks like a bug in (older?) Python versions.

Either way, I guess cqlsh can't rely on strftime to get that right.
                
> cqlsh displays bad timezone for timestamp types
> -----------------------------------------------
>
>                 Key: CASSANDRA-4437
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4437
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Tools
>    Affects Versions: 1.1.2
>         Environment: Ubuntu 10.04 64bit
>            Reporter: Emmanuel Courreges
>            Assignee: paul cannon
>            Priority: Minor
>
> cqlsh uses the time.localtime(epoch) function in python which converts the time received from thrift into your local timezone but does not fill in the timezone info, so when it is printed with time.strftime, it always appears with an hour in your timezone with +0000 as the timezone which is wrong.
> Example:
> cqlsh:ecourreges> UPDATE syndic set emails=11, unreadmails=3, nextuid=16, endwnd='2012-07-14 21:15:00+0000', endsub='2012-07-14 21:15:00+0000' where ise='ise1';
> cqlsh:ecourreges> select * from syndic;
>  ise  | alllastdetails | allmaildetails | emails | endsub                   | endwnd                   | lastdetails | lastnotif | maildetails | nextuid | unreadmails
> ------+----------------+----------------+--------+--------------------------+--------------------------+-------------+-----------+-------------+---------+-------------
>  ise1 |           null |           null |     11 | 2012-07-14 23:15:00+0000 | 2012-07-14 23:15:00+0000 |        null |      null |        null |      16 |           3
> The output should be '2012-07-14 21:15:00+0000' or '2012-07-14 23:15:00+0200' but not '2012-07-14 23:15:00+0000' !!!
> I see 2 ways of fixing it:
> cqlsh line 474: replace timestamp = time.localtime(val) with timestamp = time.gmtime(val)
> or handle the timezone properly by using something else than localtime+strftime, but the question is what?
> Good luck and keep up the great work!
> Regards,
> Emmanuel Courrèges.
> Alten Consultant for Orange Portal France.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Assigned] (CASSANDRA-4437) cqlsh displays bad timezone for timestamp types

Posted by "paul cannon (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-4437?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

paul cannon reassigned CASSANDRA-4437:
--------------------------------------

    Assignee: paul cannon
    
> cqlsh displays bad timezone for timestamp types
> -----------------------------------------------
>
>                 Key: CASSANDRA-4437
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4437
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Tools
>    Affects Versions: 1.1.2
>         Environment: Ubuntu 10.04 64bit
>            Reporter: Emmanuel Courreges
>            Assignee: paul cannon
>            Priority: Minor
>
> cqlsh uses the time.localtime(epoch) function in python which converts the time received from thrift into your local timezone but does not fill in the timezone info, so when it is printed with time.strftime, it always appears with an hour in your timezone with +0000 as the timezone which is wrong.
> Example:
> cqlsh:ecourreges> UPDATE syndic set emails=11, unreadmails=3, nextuid=16, endwnd='2012-07-14 21:15:00+0000', endsub='2012-07-14 21:15:00+0000' where ise='ise1';
> cqlsh:ecourreges> select * from syndic;
>  ise  | alllastdetails | allmaildetails | emails | endsub                   | endwnd                   | lastdetails | lastnotif | maildetails | nextuid | unreadmails
> ------+----------------+----------------+--------+--------------------------+--------------------------+-------------+-----------+-------------+---------+-------------
>  ise1 |           null |           null |     11 | 2012-07-14 23:15:00+0000 | 2012-07-14 23:15:00+0000 |        null |      null |        null |      16 |           3
> The output should be '2012-07-14 21:15:00+0000' or '2012-07-14 23:15:00+0200' but not '2012-07-14 23:15:00+0000' !!!
> I see 2 ways of fixing it:
> cqlsh line 474: replace timestamp = time.localtime(val) with timestamp = time.gmtime(val)
> or handle the timezone properly by using something else than localtime+strftime, but the question is what?
> Good luck and keep up the great work!
> Regards,
> Emmanuel Courrèges.
> Alten Consultant for Orange Portal France.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (CASSANDRA-4437) cqlsh displays bad timezone for timestamp types

Posted by "Jonathan Ellis (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CASSANDRA-4437?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jonathan Ellis updated CASSANDRA-4437:
--------------------------------------

    Assignee:     (was: paul cannon)

Personally I'm fine with an "upgrade to a working Python" workaround, but if someone wants to patch it to format by hand instead that's okay.
                
> cqlsh displays bad timezone for timestamp types
> -----------------------------------------------
>
>                 Key: CASSANDRA-4437
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4437
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Tools
>    Affects Versions: 1.1.2
>         Environment: Ubuntu 10.04 64bit
>            Reporter: Emmanuel Courreges
>            Priority: Minor
>
> cqlsh uses the time.localtime(epoch) function in python which converts the time received from thrift into your local timezone but does not fill in the timezone info, so when it is printed with time.strftime, it always appears with an hour in your timezone with +0000 as the timezone which is wrong.
> Example:
> cqlsh:ecourreges> UPDATE syndic set emails=11, unreadmails=3, nextuid=16, endwnd='2012-07-14 21:15:00+0000', endsub='2012-07-14 21:15:00+0000' where ise='ise1';
> cqlsh:ecourreges> select * from syndic;
>  ise  | alllastdetails | allmaildetails | emails | endsub                   | endwnd                   | lastdetails | lastnotif | maildetails | nextuid | unreadmails
> ------+----------------+----------------+--------+--------------------------+--------------------------+-------------+-----------+-------------+---------+-------------
>  ise1 |           null |           null |     11 | 2012-07-14 23:15:00+0000 | 2012-07-14 23:15:00+0000 |        null |      null |        null |      16 |           3
> The output should be '2012-07-14 21:15:00+0000' or '2012-07-14 23:15:00+0200' but not '2012-07-14 23:15:00+0000' !!!
> I see 2 ways of fixing it:
> cqlsh line 474: replace timestamp = time.localtime(val) with timestamp = time.gmtime(val)
> or handle the timezone properly by using something else than localtime+strftime, but the question is what?
> Good luck and keep up the great work!
> Regards,
> Emmanuel Courrèges.
> Alten Consultant for Orange Portal France.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira