1

This is a very famous question that has already been asked which I am currently implementing as well. My objective is to calculate the relative time which displays 5 minutes ago, 5 hours ago etc.,

I am trying to fetch the tweets of a user with the timeline API.
Example: http://api.twitter.com/1/statuses/user_timeline.json?screen_name=jonskeet

The main problem I am faced with is the problem the client's DateTime.Now returns. Remember, I am doing this in my mobile device which can have + or - 5 minutes in time difference because of which I am seeing weird values (like 5 minutes ago for just now posted tweets)

How to tackle this issue? I see that the twitter api does not return me a server time for me to do relative calculations.

Community
  • 1
  • 1
bragboy
  • 32,353
  • 29
  • 101
  • 167

1 Answers1

2

Well, you need to calculate with respect to something. If the client's own time is not accurate, you'll need another source. Perhaps you can query some other server for the current time, and store the offset compared to the clients local time for future calculations.

Alternatively, depending on how active your twitter stream is, you might be able to assume that newly incoming messages are current and take the average offset of the tweet times compared to the local time as an estimation of the true value of the offset.

ceyko
  • 4,767
  • 1
  • 16
  • 23
  • I am looking for specifics rather than generics. most of the above points, i considered already. but i want to know the real standard thats followed in the above similar case. – bragboy Aug 01 '12 at 15:29