示例#1
0
        string GetOffset()
        {
            int tickCount = Environment.TickCount;

            if (_offsetCacheTime + 1000 < tickCount)
            {
                _offsetCacheTime = tickCount;
                var offset  = TimeZoneInfo.Local.GetUtcOffset(DateTime.UtcNow);
                var builder = new JsonStringBuilder();
                if (offset.TotalMinutes > 0)
                {
                    builder.Append('+');
                }
                else
                {
                    builder.Append('-');
                }
                builder.AppendIntTwo(Math.Abs(offset.Hours));
                builder.Append(':');
                builder.AppendIntTwo(offset.Minutes);
                _offset = builder.ToString();
            }
            return(_offset);
        }
示例#2
0
 public BuildersBenchmark()
 {
     _jsonStringBuilder = new JsonStringBuilder();
     _stringBuilder     = new StringBuilder();
 }