Why does the hand history parser convert to UTC before saving to the database? Shouldn't we just save according to how the history is written in the file? This is coming up for me because I added some code to get the graphing dates working and I expect those dates to search by when I played a hand, not in UTC but in ET, my timezone. If I comment out the parser code that converts that date, then I can filter the graph as I would expect:
line 885 of fpdb_simple.py:
# if (site=="ftp" or site=="ps") and not isUTC: #these use US ET
# result+=datetime.timedelta(hours=5)
Is there a reason this is in there or a compromise that can be made for this code?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"Why does the hand history parser convert to UTC before saving to the database?"
To make the dates consistent between sites and make graphing easier. A large number of players play from Europe and other countries, and many other sites dont use ET or CET as the default - and dont tell you in the HH file that its UTC, localtime or other.
I haven't added it as yet, but this:
select CONVERT_TZ(Hands.handStart,'+00:00','+09:00') from Hands;
Automatically converts from UTC to my timezone when pulling from the database.
The correct solution is to convert to UTC and grab the hands based on the users local timezone.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2009-01-22
So if we were taking dates from users (who would expect those dates to be i their timezone) and used it to query the database, we should run this conversion when we actually query the database:
CONVERT_TZ(%s, 'SYSTEM', 'UTC')
That makes sense, and it even works too. :)
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Why does the hand history parser convert to UTC before saving to the database? Shouldn't we just save according to how the history is written in the file? This is coming up for me because I added some code to get the graphing dates working and I expect those dates to search by when I played a hand, not in UTC but in ET, my timezone. If I comment out the parser code that converts that date, then I can filter the graph as I would expect:
line 885 of fpdb_simple.py:
# if (site=="ftp" or site=="ps") and not isUTC: #these use US ET
# result+=datetime.timedelta(hours=5)
Is there a reason this is in there or a compromise that can be made for this code?
"Why does the hand history parser convert to UTC before saving to the database?"
To make the dates consistent between sites and make graphing easier. A large number of players play from Europe and other countries, and many other sites dont use ET or CET as the default - and dont tell you in the HH file that its UTC, localtime or other.
I haven't added it as yet, but this:
select CONVERT_TZ(Hands.handStart,'+00:00','+09:00') from Hands;
Automatically converts from UTC to my timezone when pulling from the database.
The correct solution is to convert to UTC and grab the hands based on the users local timezone.
So if we were taking dates from users (who would expect those dates to be i their timezone) and used it to query the database, we should run this conversion when we actually query the database:
CONVERT_TZ(%s, 'SYSTEM', 'UTC')
That makes sense, and it even works too. :)
Thanks.