I have a code that looks like this:
Код: Выделить всё
public static async Task SendRequest(Client client, DateTime startTime, int offset)
{
TimeSpan timeToWait = startTime - DateTime.UtcNow + TimeSpan.FromMilliseconds(offset);
await Task.Delay(timeToWait);
Console.Write(offset);
Request request = client.sendRequest();
}
async static public Task SendMultiple(Client client, DateTime startTime)
{
var offsets = new[] { -15, -10 };
offsets.ForEach(offset => tasks.Add(SendRequest(client, startTime, offset));
Request[] result = await Task.WhenAll(tasks);
}
Код: Выделить всё
08:59:59,985: -15
09:00:00,015: -10
How could I ensure that those requests are being send exactly at the time I want, please?
I am using Ubuntu*
Источник: https://stackoverflow.com/questions/781 ... val-in-c-s
Мобильная версия