Exemplo n.º 1
0
 public async Task SetTimeAsync(DateTime currentTime, DateTime newTime, string accessToken = null)
 {
     var request = new SetTimeRequest {
         LedgerId = _ledgerId, CurrentTime = Timestamp.FromDateTime(currentTime), NewTime = Timestamp.FromDateTime(newTime)
     };
     await _timeClient.WithAccess(accessToken).Dispatch(request, (c, r, co) => c.SetTimeAsync(r, co));
 }
Exemplo n.º 2
0
        public void SetTime(DateTime currentTime, DateTime newTime, string accessToken = null)
        {
            if (currentTime >= newTime)
            {
                throw new SetTimeException(currentTime, newTime);
            }

            var request = new SetTimeRequest {
                LedgerId = _ledgerId, CurrentTime = Timestamp.FromDateTime(currentTime), NewTime = Timestamp.FromDateTime(newTime)
            };

            _timeClient.WithAccess(accessToken).Dispatch(request, (c, r, co) => c.SetTime(r, co));
        }