From a66c67de6d4b9b5d16f804ab875174a34b44f26f Mon Sep 17 00:00:00 2001 From: Leonardo Sala Date: Wed, 13 Sep 2017 14:02:43 +0200 Subject: [PATCH] Startup --- script/TestTimestampTable.py | 6 +++--- script/test/CompareTimestampIocAndPc.py | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 script/test/CompareTimestampIocAndPc.py diff --git a/script/TestTimestampTable.py b/script/TestTimestampTable.py index b560de7..1567f2c 100644 --- a/script/TestTimestampTable.py +++ b/script/TestTimestampTable.py @@ -3,10 +3,11 @@ import datetime def after(rec, scan): - path = get_exec_pars().group+"/time" + cache = bpm6a.takeTimestamped() + path = get_exec_pars().group+"/TimeIOC" if rec.index==0: create_dataset(path, 's') - time_str = str(datetime.datetime.fromtimestamp(bpm6a.timestamp/1000.0)) + time_str = str(datetime.datetime.fromtimestamp(cache.nanos/1e9)) append_dataset(path, time_str , type = 's') mscan(bpm6a, bpm6a, -1, 1000.0, after_read = after) @@ -14,4 +15,3 @@ mscan(bpm6a, bpm6a, -1, 1000.0, after_read = after) #tscan(bpm6a, b5, 2.0) - diff --git a/script/test/CompareTimestampIocAndPc.py b/script/test/CompareTimestampIocAndPc.py new file mode 100644 index 0000000..e0b7592 --- /dev/null +++ b/script/test/CompareTimestampIocAndPc.py @@ -0,0 +1,19 @@ +import datetime + + +def after(rec, scan): + cache = bpm6a.takeTimestamped() + path = get_exec_pars().group+"/time" + pathpc = get_exec_pars().group+"/timepc" + if rec.index==0: + create_dataset(path, 's') + create_dataset(pathpc, 's') + time_str = str(datetime.datetime.fromtimestamp(cache.nanos/1e9)) + append_dataset(path, time_str , type = 's') + time_str = str(datetime.datetime.fromtimestamp(time.time())) + append_dataset(pathpc, time_str , type = 's') + time.sleep(2.0) + +mscan(bpm6a, bpm6a, -1, 10.0, after_read = after) + +