Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions code/common/eodtime.q
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ adjtime:{[p]

// function to get time (in UTC) of next roll after UTC timestamp, p
getroll:{[p]
z:rolltimeoffset-adjtime[p]; // convert rolltimeoffset from rolltimezone to UTC
z:`timespan$(mod) . "j"$z, 1D; // force time adjust to be between 0D and 1D
("d"$p) + $[z <= p;z+1D;z] // if past time already today, make it tomorrow
rolltod:`timespan$(mod) . "j"$rolltimeoffset,1D; // roll time of day, in rolltimezone
localp:.tz.lg[rolltimezone;p]; // p in rolltimezone
localroll:("d"$localp)+rolltod; // today's roll, local
localroll:$[localroll<=localp;localroll+1D;localroll]; // if already passed, use tomorrow
.tz.gl[rolltimezone;localroll] // local to UTC, using the offset at the roll time
};

// function to determine the date (in rolltimezone) from UTC timestamp, p
Expand Down
2 changes: 1 addition & 1 deletion tests/stp/chainedeod/eodroutine.csv
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ true,0,0,q,1=counttplogs[`stptest1],1,,"Should be 1 log directory for STP"
true,0,0,q,1=counttplogs[`sctptest1],1,,"Should be 1 log directory for SCTP"
run,0,0,q,now:.z.p,1,,"Get current time"
run,0,0,q,data:stpHandle".stplg.endofdaydata[]",1,,"get data"
run,0,0,q,"stpHandle(`.stplg.stpeod;.eodtime.d;data,(enlist `p)!enlist now)",1,,"Run EoD function on STP"
run,0,0,q,"stpHandle(`.stplg.endofday;.eodtime.d;data,(enlist `p)!enlist now)",1,,"Run EoD function on STP"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some unit tests to cover the getroll behaviour we are making the fix for?
e.g. around midnight when the clocks change in NY/London/both

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

true,0,0,q,all 0 = sctpHandle"count each `. .stpps.t",1,,"Check tables have been flushed"
run,0,0,q,meta2:get .Q.dd[sctpDir1;`stpmeta],1,,"Get meta table from disk"
run,0,0,q,stpEod2:stpHandle".eodtime.d",1,,"Get new date on STP"
Expand Down
8 changes: 4 additions & 4 deletions tests/stp/chainedeod/process.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
host,port,proctype,procname,U,localtime,g,T,w,load,startwithall,extras,qcmd
localhost,{KDBBASEPORT}+100,discovery,discovery1,${TORQHOME}/appconfig/passwords/accesslist.txt,1,0,,,${KDBCODE}/processes/discovery.q,1,,q
localhost,{KDBBASEPORT}+101,segmentedtickerplant,stptest1,${TORQHOME}/appconfig/passwords/accesslist.txt,1,0,,,${KDBCODE}/processes/segmentedtickerplant.q,1,-schemafile ${TORQHOME}/database.q,q
localhost,{KDBBASEPORT}+102,segmentedchainedtickerplant,sctptest1,${TORQHOME}/appconfig/passwords/accesslist.txt,1,0,,,${KDBCODE}/processes/segmentedtickerplant.q,1,-parentproctype segmentedtickerplant -.sctp.loggingmode create -.sctp.tickerplantname stptest1,q
localhost,{KDBBASEPORT}+103,rdb,rdb1,${TORQHOME}/appconfig/passwords/accesslist.txt,1,1,180,,${KDBCODE}/processes/rdb.q,1,-.rdb.tickerplanttypes segmentedchainedtickerplant,q
localhost,{KDBBASEPORT}+100,discovery,discovery1,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,0,,,${KDBCODE}/processes/discovery.q,1,,q
localhost,{KDBBASEPORT}+101,segmentedtickerplant,stptest1,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,0,,,${KDBCODE}/processes/segmentedtickerplant.q,1,-schemafile ${TORQAPPHOME}/database.q,q
localhost,{KDBBASEPORT}+102,segmentedchainedtickerplant,sctptest1,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,0,,,${KDBCODE}/processes/segmentedtickerplant.q,1,-parentproctype segmentedtickerplant -.sctp.loggingmode create -.sctp.tickerplantname stptest1,q
localhost,{KDBBASEPORT}+103,rdb,rdb1,${TORQAPPHOME}/appconfig/passwords/accesslist.txt,1,1,180,,${KDBCODE}/processes/rdb.q,1,-.rdb.tickerplanttypes segmentedchainedtickerplant,q
1 change: 1 addition & 0 deletions tests/stp/chainedeod/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ${TORQHOME}/torq.sh start discovery1 stptest1 sctptest1 rdb1 -csv ${testpath}/pr
-load ${KDBTESTS}/helperfunctions.q ${testpath}/settings.q \
-results ${KDBTESTS}/stp/results/ \
-procfile ${testpath}/process.csv \
-debug \

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think this is left from your testing if you can remove

-runtime $run \
$debug $stop $quiet

Expand Down