Last active
February 16, 2016 00:44
-
-
Save nuitsjp/21a568baede3b341e386 to your computer and use it in GitHub Desktop.
時間の間隔定義にはTimeSpanが便利! ref: http://qiita.com/Nuits/items/00010cf724c6ce6e1974
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// ポーリング間隔:1分 | |
/// </summary> | |
private static readonly int PollingInterval = 60 * 1000; | |
static void Main(string[] args) | |
{ | |
while (true) | |
{ | |
// 一定時間スリープする | |
System.Threading.Thread.Sleep(PollingInterval); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// ポーリング間隔:1分 | |
/// </summary> | |
private static readonly TimeSpan PollingInterval = TimeSpan.FromMinutes(1); | |
static void Main(string[] args) | |
{ | |
while (true) | |
{ | |
// 一定時間スリープする | |
System.Threading.Thread.Sleep(PollingInterval); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 日単位 | |
private static readonly TimeSpan PollingInterval = TimeSpan.FromDays(1); | |
/// 時間単位 | |
private static readonly TimeSpan PollingInterval = TimeSpan.FromHours(1); | |
/// 分単位 | |
private static readonly TimeSpan PollingInterval = TimeSpan.FromMinutes(1); | |
/// 秒単位 | |
private static readonly TimeSpan PollingInterval = TimeSpan.FromSeconds(1); | |
/// ミリ秒単位 | |
private static readonly TimeSpan PollingInterval = TimeSpan.FromMilliseconds(1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 2時間30分 | |
private static readonly TimeSpan PollingInterval = | |
TimeSpan.FromHours(2) + TimeSpan.FromMinutes(30); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment