From 4837bc24ba83605786814c0643632255a60222c2 Mon Sep 17 00:00:00 2001 From: Kimura Youichi Date: Mon, 7 May 2018 11:53:09 +0900 Subject: [PATCH] =?utf8?q?=E6=99=82=E9=80=9F=E8=A8=88=E7=AE=97=E3=81=AB?= =?utf8?q?=E4=BD=BF=E7=94=A8=E3=81=99=E3=82=8B=E6=97=A5=E6=99=82=E3=81=AE?= =?utf8?q?=E5=9E=8B=E3=82=92DateTimeUtc=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- OpenTween/Models/HomeTabModel.cs | 10 +++++----- OpenTween/Tween.cs | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/OpenTween/Models/HomeTabModel.cs b/OpenTween/Models/HomeTabModel.cs index 8bfa474a..87887560 100644 --- a/OpenTween/Models/HomeTabModel.cs +++ b/OpenTween/Models/HomeTabModel.cs @@ -45,7 +45,7 @@ namespace OpenTween.Models // 流速計測用 private int tweetsPerHour = 0; - private ConcurrentDictionary tweetsTimestamps = new ConcurrentDictionary(); + private ConcurrentDictionary tweetsTimestamps = new ConcurrentDictionary(); public HomeTabModel() : this(MyCommon.DEFAULTTAB.RECENT) { @@ -58,7 +58,7 @@ namespace OpenTween.Models public override void AddPostQueue(PostClass post) { base.AddPostQueue(post); - this.UpdateTimelineSpeed(post.CreatedAt); + this.UpdateTimelineSpeed(new DateTimeUtc(post.CreatedAt.ToUniversalTime())); } public override async Task RefreshAsync(Twitter tw, bool backward, bool startup, IProgress progress) @@ -86,9 +86,9 @@ namespace OpenTween.Models /// /// タイムラインに追加された発言件数を反映し、タイムラインの流速を更新します /// - private void UpdateTimelineSpeed(DateTime postCreatedAt) + private void UpdateTimelineSpeed(DateTimeUtc postCreatedAt) { - var now = DateTime.Now; + var now = DateTimeUtc.Now; // 1 時間以上前の時刻は追加しない var oneHour = TimeSpan.FromHours(1); @@ -97,7 +97,7 @@ namespace OpenTween.Models this.tweetsTimestamps.AddOrUpdate(postCreatedAt, 1, (k, v) => v + 1); - var removeKeys = new List(); + var removeKeys = new List(); var tweetsInWindow = 0; foreach (var (timestamp, count) in this.tweetsTimestamps) { diff --git a/OpenTween/Tween.cs b/OpenTween/Tween.cs index 9db539f9..c46a9233 100644 --- a/OpenTween/Tween.cs +++ b/OpenTween/Tween.cs @@ -172,8 +172,8 @@ namespace OpenTween private Tuple inReplyTo = null; // リプライ先のステータスID・スクリーン名 //時速表示用 - private List _postTimestamps = new List(); - private List _favTimestamps = new List(); + private List _postTimestamps = new List(); + private List _favTimestamps = new List(); // 以下DrawItem関連 private SolidBrush _brsHighLight = new SolidBrush(Color.FromKnownColor(KnownColor.Highlight)); @@ -2569,7 +2569,7 @@ namespace OpenTween throw new WebApiException("NG(Restricted?)"); } - this._favTimestamps.Add(DateTime.Now); + this._favTimestamps.Add(DateTimeUtc.Now); // TLでも取得済みならfav反映 if (this._statuses.ContainsKey(statusId)) @@ -2597,7 +2597,7 @@ namespace OpenTween } // 時速表示用 - var oneHour = DateTime.Now - TimeSpan.FromHours(1); + var oneHour = DateTimeUtc.Now - TimeSpan.FromHours(1); foreach (var i in MyCommon.CountDown(this._favTimestamps.Count - 1, 0)) { if (this._favTimestamps[i] < oneHour) @@ -2847,9 +2847,9 @@ namespace OpenTween return; } - this._postTimestamps.Add(DateTime.Now); + this._postTimestamps.Add(DateTimeUtc.Now); - var oneHour = DateTime.Now - TimeSpan.FromHours(1); + var oneHour = DateTimeUtc.Now - TimeSpan.FromHours(1); foreach (var i in MyCommon.CountDown(this._postTimestamps.Count - 1, 0)) { if (this._postTimestamps[i] < oneHour) @@ -2925,9 +2925,9 @@ namespace OpenTween p.Report(Properties.Resources.PostWorker_RunWorkerCompletedText4); - this._postTimestamps.Add(DateTime.Now); + this._postTimestamps.Add(DateTimeUtc.Now); - var oneHour = DateTime.Now - TimeSpan.FromHours(1); + var oneHour = DateTimeUtc.Now - TimeSpan.FromHours(1); foreach (var i in MyCommon.CountDown(this._postTimestamps.Count - 1, 0)) { if (this._postTimestamps[i] < oneHour) -- 2.11.0