Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Français - Português - Русский
Scilabヘルプ >> Time and Date > realtimeinit

realtimeinit

時間の単位を設定

realtime

日付の原点を設定または指定日付まで待つ

呼び出し手順

realtimeinit(time_unit)
realtime(t0)
realtime(t)

パラメータ

time_unit

実数. realtime の引数に関連する秒数

t0

decimal number: initial datetime, in time_unit. This meaning holds when realtime(…) is called for the first time after the last realtimeinit(…). This first call sets the datetime origin and restarts the real timer.

t

実数. 日付

説明

これら2つの関数はScilabで実時間を処理する際に使用できます.

realtimeinit(time_unit) は, realtime の引数 tに 関する時間の単位を定義します.

realtime(t0)を最初にコールした際, カレントの日付がt0に設定されます. これ以降のコールrealtime(t)では, 日付tに達するまで待機します.

In the following example, in a loop, a job takes an arbitrary time, from 0 to 1.50 s. This is simulated with a sleep() of random duration. Although this period is not regular, realtime() is used to compensate and print something every 2.00 seconds:

clc
tic();
realtimeinit(2.00);
realtime(0);
for k = 1:10
    if k==1, mprintf("\nSleep for  Wake-up at   Wait until date\n"), end
    d = rand(1,1);
    sleep(d*1500);
    mprintf(' %4.2f s     %5.2f s', d*1.5, toc());
    realtime(k);
    mprintf('      %5.2f s\n', toc());
end
Sleep for  Wake-up at   Wait until date
 0.28 s      0.57 s       2.08 s
 0.03 s      2.11 s       4.08 s
 1.27 s      5.34 s       6.08 s
 0.11 s      6.19 s       8.08 s
 1.28 s      9.36 s      10.08 s
 0.02 s     10.10 s      12.08 s
 0.28 s     12.36 s      14.08 s
 0.74 s     14.82 s      16.08 s
 1.12 s     17.20 s      18.08 s
 1.41 s     19.49 s      20.08 s

参照

  • sleep — suspend all code executions (console, scripts, callbacks,..)
  • getdate — 日付と時間に関する情報を取得
  • waitbar — waitbarを描画
  • progressionbar — 進行バーを描画
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Thu Feb 14 15:02:16 CET 2019