teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

誤り訂正

2017/09/06 08:05

投稿

otn
otn

スコア86349

answer CHANGED
@@ -1,7 +1,8 @@
1
1
  処理Aでは、
2
2
  ```Ruby
3
- open(File.expand_path("~/.lasttime"),"w"){|f| f.write DateTime.now.strftime("%F %T") }
3
+ open(File.expand_path("~/.lasttime"),"w"){|f| f.write DateTime.now.strftime("%F %T %Z") }
4
4
  ```
5
+ (↑当初、タイムゾーンが抜けていたので、追加しました)
5
6
  して、処理Bでは、
6
7
  ```Ruby
7
8
  if DateTime.now - DateTime.parse(open(File.expand_path("~/.lasttime"),&:read)) >= 1