cancel
Showing results for 
Search instead for 
Did you mean: 

use of timespan in tick.q

joshmyzie2
New Contributor
It's easy enough to swap timespan for timestamp in tick.q, but I wascurious why timespan is the default.For rdb queries and other tick.q subscribers, I find that I often wantto compare the relative values of two timespans, but can't because thedate isn't recorded until saving down to the hdb.Isn't using the timestamp type the obvious solution here? I get thatthe date component of timestamp would be redundant in the hdb, but whatother solution is there for real-time data?Thanks,Josh
3 REPLIES 3

sohagan
New Contributor
Hi Josh,

Are you running a modified version of tick?

tick by default uses .z.p - which is timestamp. timestamp minus timestamp = timespan, which sounds like what you require.

http://code.kx.com/wsvn/code/kx/kdb%2Btick/tick.q
/2012.11.09 use timestamp type rather than time. -19h/"t"/.z.--16h/"n"/.z.P

Thanks,
Sean

joshmyzie2
New Contributor


Hi Sean,

I am using the standard tick.q.

While it does call .z.P, it only retains the timespan portion:

if[d<"d"$a:.z.P;.z.ts[]];a:"n"$a;

Like I said, it's trivial to alter, but was just curious why timespan is
the default.

Thanks,
Josh

charset="UTF-8"

X-Mailer: Microsoft Outlook 14.0
Thread-Index: AQHM71PTfjR2Gt5nyXbQdRtzgokoEgJPflBmAbQOmxmfCxRPAA==
Content-Language: de


>>> if[d<"d"$a:.z.P;.z.ts[]];a:"n"$a;


The tp is also responsible to send the eod signal. So with .z.P it will =
also be able to check whether the day has switched or not.

Kim

-----Urspr=C3=BCngliche Nachricht-----
Von: personal-kdbplus@googlegroups.com =
[mailto:personal-kdbplus@googlegroups.com] Im Auftrag von =
joshmyzie2@yandex.com
Gesendet: Montag, 8. Februar 2016 15:33
An: personal-kdbplus@googlegroups.com
Betreff: Re: [personal kdb+] Re: use of timespan in tick.q


Hi Sean,

I am using the standard tick.q.

While it does call .z.P, it only retains the timespan portion:

if[d<"d"$a:.z.P;.z.ts[]];a:"n"$a;

Like I said, it's trivial to alter, but was just curious why timespan is =
the default.

Thanks,
Josh