TimeHelper.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Globalization;
  3. namespace ET
  4. {
  5. public static class TimeHelper
  6. {
  7. public const long OneDay = 86400000;
  8. public const long Hour = 3600000;
  9. public const long Minute = 60000;
  10. /// <summary>
  11. /// 客户端时间
  12. /// </summary>
  13. /// <returns></returns>
  14. public static long ClientNow()
  15. {
  16. return TimeInfo.Instance.ClientNow();
  17. }
  18. public static long ClientNowSeconds()
  19. {
  20. return ClientNow() / 1000;
  21. }
  22. public static DateTime DateTimeNow()
  23. {
  24. return DateTime.Now;
  25. }
  26. public static long ServerNow()
  27. {
  28. return TimeInfo.Instance.ServerNow();
  29. }
  30. public static int ServerNowSecs
  31. {
  32. get
  33. {
  34. return (int)(ServerNow() / 1000);
  35. }
  36. }
  37. public static long ClientFrameTime()
  38. {
  39. return TimeInfo.Instance.ClientFrameTime();
  40. }
  41. public static long ServerFrameTime()
  42. {
  43. return TimeInfo.Instance.ServerFrameTime();
  44. }
  45. }
  46. }