Current Time --> HUD

Forum for users that want to write their own custom queries against the PT database either via the Structured Query Language (SQL) or using the PT3 custom stats/reports interface.

Moderator: Moderators

Current Time --> HUD

Postby andyco » Thu Feb 03, 2011 4:35 pm

Simple (?) Question regarding how PT3 handles/uses time....

Is there a way to reference the current time/date (in Tourney Player Stats) (so i can use the value in HUD stats?)

I haven't been able to find a clear solution or idea for this in previous posts/replies/"get more"...

I do understand the limitation on the variable/stat's accuracy implied w/ having to update the cache.
thanx in advance
andyco
 
Posts: 16
Joined: Wed Sep 22, 2010 4:00 pm

Re: Current Time --> HUD

Postby kraada » Thu Feb 03, 2011 4:45 pm

"localtimestamp" (without the quotes) references the current time - it should work properly in the columns (just remember that when the cache is updated after a hand is imported, "localtimestamp" is checked then and not again until you rebuild the cache).
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Current Time --> HUD

Postby andyco » Thu Feb 03, 2011 8:05 pm

Thanx krada.
i'm not sure what i'm doing wrong, but I keep getting a "the statement is no valid SQL." error when trying to save the column.

are there any examples of which you can point me to on how it's localtimestamp used?
... or other examples of using/referencing the "current time" in a column, variable or stat.

thanx (again) in advance.
andyco
 
Posts: 16
Joined: Wed Sep 22, 2010 4:00 pm

Re: Current Time --> HUD

Postby WhiteRider » Fri Feb 04, 2011 4:54 am

Can you describe what you're trying to do? I'm not sure that anything time related will work in HUD stats because of the cache issue that Kraada mentioned.
WhiteRider
Moderator
 
Posts: 54025
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Current Time --> HUD

Postby andyco » Fri Feb 04, 2011 1:07 pm

In lieu of reference of the "Current Time", Is there a way to reference either:
a) How much time has been spent in a given "session"?
for an STT this will be time in a given tournament.
or b) The time the last hand was played (id = 0 in live_table_table_history_stat)?
I could use this time to approximate the "current time"....
I play a lot of single table SnGs, so knowing the current length of the active session would allow me to back out the
current time from either of these values.

More Specifically/Simply -- looking for a way to have the "Current Time" stored as a HTPS Column or Variable;
I can then use that term in wider range of Variables and Stats (~described below)

--- to answer your longer question: "What am i trying to do...?" -----------
While playing MTTs, STTs and SnGs & developing custom HUD stats, over the last few months there has
been a few cases where being able to estimate
(remaining) length of Blind Level (mins and/or # hands)
# hands per level
# hands per hour
anticipating/predicting the next blind level (timing & magnitude)
BB-won/hour
Blind-off estimation given current stack size (# hands, # orbits, Blind Levels, ...)

I realize the cache will limit me to only an estimate of the current time. Even w/ this limitation, it should allow me a closer
approximation for some of these stats, (than predictions w/out any reference of time at all).
More Specifically/Simply -- looking for a way to have the "Current Time" stored as a HTPS Column or Variable;
I will then use that term in Variables and Stats (~described above). I am able to get 'stored' time values
(tourney start time, end time, date played... ), but that remains only 1 of the two data points i need to
measure/estimate the time at a given session/table/blind/# of hands/...

------- One example: Suppose you wanted estimate the Blind-off time (given a current stack size) ---------------------
measured in Hands (or time). i.e. How many hands could i expect to play (fold)
before my stack runs out. ... and roughly, how many mins would that be?

you can currently only approximate the linear estimation of based on the current (or last hand's) Blinds, Antes and Players
at the table. As you can imagine, this grossly over-estimates the # hands left because it doesn't factor in the increasing
blinds/antes. You can significantly improve this estimation with some assumptions on these key variables, but you must
be able to either
a) know how long you've spent in a given session/table/blind
(Hours:mins per current session, HH:MM per current/recent blind level, ...)
or b) count the Num hands you're playing per blind level (& which level you're on).
(cnt_hand of current blind level & per recent blind levels, ....)

please don't focus on too much on this particular example - i offer it as an example of one of the places i've run into this basic
interest in a "current time" constant. so i can make relative measurements and calculations. Surely the desire for players
to be able to track/produce stats relative to the "Last 15 mins" or "The Last 20 hands" has come up before (especially for
real-time or HUD stats).

If you can point me to the tools (& some examples of their use) that will allow me the closest approximation, i'll be able to better address
any future stats i may want/need to develop. (("feed a man; .... teach a man to fish; ...."))

i'm believe i understand the limitations which cache updating (or lack thereof) will impose on a "current" time... (This could make the
"Current Time" as old as the most recent cache refresh) i'm willing to invest the hours developing and testing
these time-based stats, even if/when i find out the accuracy doesn't allow me the insights to make them useful. but i need to
test this accuracy (& it's usefulness) before giving up....

thanx in advance
andyco
 
Posts: 16
Joined: Wed Sep 22, 2010 4:00 pm

Re: Current Time --> HUD

Postby WhiteRider » Fri Feb 04, 2011 1:31 pm

To do stuff like this for hero only should be possible (some of it at least) as the cache is not used for hero because stats are session/tournament only.
The following doesn't use current time, but uses the difference between the start of the session/tournament and the last hand played.

I have a cash stat in Holdem Cash Player Statistics which displays the time at the current table.
It uses this column:

time_after_session_start_mins_max =
max( trunc( ( extract(epoch from holdem_hand_player_statistics.date_played) - extract (epoch from holdem_table_session_summary.date_start) ) / 60 ) ) + 1

This is the largest (max) value of the number of minutes between the start of the session and the time each hand was played (so the latest hand).
For tournaments you'd need to use "tourney_holdem_hand_summary.date_played" and "tourney_holdem_summary.date_start" but the same principal should apply.

My stat has this Format Expression to display it neatly as a number of hours and minutes:

format( '{1}:{2}{3}',
format_number( if ( time_after_session_start_mins_max < 60, 0, (time_after_session_start_mins_max - 30) / 60 ), 0, false, false),
if ( time_after_session_start_mins_max MOD 60 < 10, '0', ''),
format_number(time_after_session_start_mins_max MOD 60, 0, false, false) )

I don't have time to build any specific example for you right now (dinner time) but I'll be on again later so please post back if you have any further questions.
WhiteRider
Moderator
 
Posts: 54025
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Current Time --> HUD

Postby andyco » Fri Feb 04, 2011 3:03 pm

Exactly identical to one path i was heading down. i wasn't sure a simple "max" screen of the
hand dates would always be the most recent hand... this should produce what i'm looking for...

thanx. ...and enjoy dinner...
andyco
 
Posts: 16
Joined: Wed Sep 22, 2010 4:00 pm


Return to Custom Stats, Reports, and SQL [Read Only]

Who is online

Users browsing this forum: No registered users and 4 guests