8.93. tseconds 経過秒数

  • 書式1: tseconds(time)

  • 書式2: tuseconds(time)

00:00:00から時刻 \(time\) までの経過秒数を計算する。 tsecondsでは秒単位で、tusecondsではマイクロ秒単位で値を返す。

利用例

importと入力データ(CSV)の準備

 1import nysol.mcmd as nm
 2
 3with open('dat1.csv','w') as f:
 4  f.write(
 5'''id,time
 61,000103
 72,235959
 83,235959.123
 94,000000
10''')
11
12with open('dat2.csv','w') as f:
13  f.write(
14'''id,time
151,20130901000103
162,20130902000103
173,20130902000103.123
18''')

基本例

1nm.mcal(c='tseconds($t{time})', a='rsl', i="dat1.csv", o="rsl1.csv").run()
2### rsl1.csv の内容
3# id,time,rsl
4# 1,000103,63
5# 2,235959,86399
6# 3,235959.123,86399
7# 4,000000,0

日付が異なっても結果は同じ

1nm.mcal(c='tseconds($t{time})', a='rsl', i="dat2.csv", o="rsl2.csv").run()
2### rsl2.csv の内容
3# id,time,rsl
4# 1,20130901000103,63
5# 2,20130902000103,63
6# 3,20130902000103.123,63

マイクロ秒

1nm.mcal(c='tuseconds($t{time})', a='rsl', i="dat1.csv", o="rsl3.csv").run()
2### rsl3.csv の内容
3# id,time,rsl
4# 1,000103,63
5# 2,235959,86399
6# 3,235959.123,86399.123
7# 4,000000,0