Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

New Post: Retrieving Twitter Server time

$
0
0
Hi,

I am not happy with the current way to retrieve the X-RateLimit with the current Release.
As a result I checked a solution allowing you to retrieve the DateTime of the previous request.
        public DateTime ServerDateTimeOfPreviousRequest
        {
            get
            {
                if (_lastHeadersResult == null)
                {
                    throw new Exception("You cannot access the server datetime before performing any HttpRequest");
                }

                if (_lastHeadersResult["Date"] == null)
                {
                    throw new Exception("Twitter didn't provide the server time information during the previous HttpRequest");
                }

                return DateTime.Parse(_lastHeadersResult["Date"]);
            }
        }
Kind Regards,
Linvi

Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>