File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,10 @@ use powershell_script::PsScriptBuilder;
22use rand:: seq:: SliceRandom ;
33use std:: collections:: HashMap ;
44use std:: env;
5+ use std:: thread:: sleep;
56use std:: fs:: File ;
67use std:: io:: { self , Error , Read , Write } ;
8+ use std:: time:: { SystemTime , Duration , UNIX_EPOCH } ;
79
810fn main ( ) {
911 // コマンドライン引数を読み込む
@@ -794,6 +796,22 @@ impl Executor {
794796 self . stack . push ( a) ;
795797 }
796798
799+ // 日付処理
800+
801+ // 現在時刻を取得
802+ "now-time" => {
803+ self . stack . push ( Type :: Number (
804+ SystemTime :: now ( )
805+ . duration_since ( UNIX_EPOCH )
806+ . unwrap ( )
807+ . as_secs_f64 ( ) ,
808+ ) ) ;
809+ }
810+
811+ "sleep" => {
812+ sleep ( Duration :: from_secs_f64 ( self . pop_stack ( ) . get_number ( ) ) )
813+ }
814+
797815 // コマンドとして認識されない場合は文字列とする
798816 _ => self . stack . push ( Type :: String ( command) ) ,
799817 }
You can’t perform that action at this time.
0 commit comments