UNIX time support

Add your suggestions for improving Poker Mavens

UNIX time support

Postby ddd » Tue Mar 05, 2019 8:46 am

Supporting UNIX time as a time input in the API (e.g. for tournament start times) will allow for easier date/time entry and conversion.
When a UNIX time is retrieved in any field in the game client, a simple javascript snippet can convert those time fields to a human readable date/time in the user's local timezone.
ddd
 
Posts: 16
Joined: Sat Jan 12, 2019 6:13 pm

Re: UNIX time support

Postby Kent Briggs » Tue Mar 05, 2019 10:40 am

The client already uses a simple Javascript snippet to convert tournament times to each player's local time so I don't understand what problem that solves. It would just make setting up the tournament more difficult as the admin would have to first convert normal time to unix time.
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 4041
Joined: Wed Mar 19, 2008 8:47 pm

Re: UNIX time support

Postby ddd » Wed Mar 06, 2019 7:27 am

I didn't realize dates/times are already converted. That's good to know.

I'd like to suggest supporting UNIX times next to the current human readable times.

As for why use UNIX time instead of normal time: most frameworks, APIs, servers, and most importantly databases already use unix time over human readable time. It's a standard. Most frameworks already convert times to unix, so there's actually more conversion work for the developer to make sure it's consistent with the standard for times used in their existing stack.

Right now, using existing frameworks for posting times there's actually more conversion that the developer has to do to store it correctly in their database:

For example: If you want to copy a tournament and have the same one 3 days later using the API: you have to convert the time to unix back and forth so you can easily add one day (in seconds), and then convert it back to the PMavens software time before posting to pokermavens.

Code: Select all
/*
 * View
 */

 //Tournament creation form:
$form->field($model, 'start_time')->widget(DateTimePicker::class, [
            'options' => ['placeholder' => 'Enter event time ...'],
            'pluginOptions' => [
                'format' => 'yyyy-mm-dd hh:ii',
                'autoclose' => true
            ]
        ]);

/*
 * Model:
 */

// Time is readable for PMMavens, but database uses unix time, so convert to unix time in controller
$this->start_time = strtotime($this->start_time);

// Set tournament with days added to previous start time
$model->start_time += TimeCheatSheet::ONE_DAY * 3;

/*
 * Controller
 */

// Post new start time to pokermavens
$pokerMavensData['TournamentStart'] = TimeHelper::asDatetime($model->start_time, 'yyyy-MM-dd HH:mm');



If unix time is supported, this would be the code:

Code: Select all
/*
 * View
 */

 //Tournament creation form:
$form->field($model, 'start_time')->widget(DateTimePicker::class, [
            'options' => ['placeholder' => 'Enter event time ...'],
            'pluginOptions' => [
                'format' => 'u',
                'autoclose' => true
            ]
        ]);


/*
 * Controller
 */

// Set tournament with days added to previous start time
$model->start_time += TimeCheatSheet::ONE_DAY * 3;

/*
 * Model
 */

// Data to post to poker mavens
$pokerMavensData['TournamentStart'] = $model->start_time;


Zero thought has to be put in to converting from/to human readable times.
ddd
 
Posts: 16
Joined: Sat Jan 12, 2019 6:13 pm

Re: UNIX time support

Postby Kent Briggs » Wed Mar 06, 2019 11:06 am

ddd wrote:I didn't realize dates/times are already converted. That's good to know.


Yes, the server converts times to UTC and each client converts that back to their own local time.

most frameworks, APIs, servers, and most importantly databases already use unix time over human readable time.


Well I don't use it, not even in my databases. I'd rather keep it human readable than save a few bytes.
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 4041
Joined: Wed Mar 19, 2008 8:47 pm

Re: UNIX time support

Postby ddd » Thu Mar 07, 2019 9:24 am

Kent, how does the time conversion work in the Tournaments lobby? Neither myself or any of our testers are able to see the tournament time in their local timezone. Instead it always seems to show the time in the Windows Server's configured timezone.
ddd
 
Posts: 16
Joined: Sat Jan 12, 2019 6:13 pm

Re: UNIX time support

Postby Kent Briggs » Thu Mar 07, 2019 10:33 am

ddd wrote:Kent, how does the time conversion work in the Tournaments lobby? Neither myself or any of our testers are able to see the tournament time in their local timezone. Instead it always seems to show the time in the Windows Server's configured timezone.


Tournament start times are also displayed in each player's local time. Be aware that daylight saving time kicks in this weekend in the USA. Do your tournaments start before or after that? Version 5.26+ and version 6.06+ should be displaying those correctly. Versions prior to 5.26 or 6.00 to 6.08 will be off until DST kicks in. Otherwise if your times are off then your server's clock or time zone or DST setting is not correct.
Kent Briggs - [email protected]
Briggs Softworks - http://www.briggsoft.com
Kent Briggs
Site Admin
 
Posts: 4041
Joined: Wed Mar 19, 2008 8:47 pm


Return to Wish List

Who is online

Users browsing this forum: No registered users and 1 guest

cron