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); }
public BuildersBenchmark() { _jsonStringBuilder = new JsonStringBuilder(); _stringBuilder = new StringBuilder(); }