GenTimeAccuracy.cs 912 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
  4. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Tsp;
  5. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Tsp
  6. {
  7. public class GenTimeAccuracy
  8. {
  9. private Accuracy accuracy;
  10. public GenTimeAccuracy(
  11. Accuracy accuracy)
  12. {
  13. this.accuracy = accuracy;
  14. }
  15. public int Seconds { get { return GetTimeComponent(accuracy.Seconds); } }
  16. public int Millis { get { return GetTimeComponent(accuracy.Millis); } }
  17. public int Micros { get { return GetTimeComponent(accuracy.Micros); } }
  18. private int GetTimeComponent(
  19. DerInteger time)
  20. {
  21. return time == null ? 0 : time.IntValueExact;
  22. }
  23. public override string ToString()
  24. {
  25. return Seconds + "." + Millis.ToString("000") + Micros.ToString("000");
  26. }
  27. }
  28. }
  29. #pragma warning restore
  30. #endif