Time source for cServer

Created at 28 Aug 2014, 00:33
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
AlexanderRC's avatar

AlexanderRC

Joined 04.02.2014

Time source for cServer
28 Aug 2014, 00:33


What time source is used for synchronizing cServer instances?

Consider the following code of indicator

using System;
using cAlgo.API;
using cAlgo.API.Internals;

namespace cAlgo
{
    [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class ServerandLocalTime : Indicator
    {
        protected override void Initialize()
        {
            Timer.Start(TimeSpan.FromMilliseconds(10));
        }

        public override void Calculate(int index)
        {
        }

        protected override void OnTimer()
        {
            DateTime serverNow = Server.Time.ToLocalTime();
            DateTime localNow = DateTime.Now;
            TimeSpan difference = localNow - serverNow;
            ChartObjects.DrawText("test", "S:" + serverNow.ToLocalTime().ToString() + "\nL:" + localNow.ToString() + "\nD: " + difference.TotalMilliseconds, StaticPosition.TopLeft, Colors.Beige);
        }
    }
}

It shows that my local time is ahead of server time even if I sync with time.nist.gov

See the screenshot below.

What time source should I use to have local time as the cServer?


@AlexanderRC