【Linux系统编程】第四十五弹---线程互斥:从问题到解决,深入探索互斥量的原理与实现

夏沐沐

关注

阅读 7

2024-11-12

  /// <summary>
  /// 时间戳
  /// </summary>
  /// <returns></returns>
  public static long GetCurrentUinxTime()
  {
      DateTime currentDate = DateTime.Now;//当前时间
      //转化为时间戳
      DateTime localTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
      return long.Parse((currentDate - localTime).TotalSeconds.ToString().Split(',')[0]);
  }

精彩评论(0)

0 0 举报