TamKap
TamKap

Reputation: 159

Difference between client and server time ServiceStack

I have a web service, built on ServiceStack. It serves protobuf-net requests from window form users.

I would simply like to know how to automatically get the user's machine Current Time (for every sent request) for checking if exist time difference between client and server sides. I would like to know if there is any built in option with servicestack or other options too... to get time when request was sent.

Upvotes: 2

Views: 122

Answers (1)

mythz
mythz

Reputation: 143399

ServiceStack doesn't return any built-in Metadata with its Responses, so you'd need to add a DateTime property in your Request DTO, but if the purpose is to measure differences I'd look at returning DateTime.Ticks instead or if the client is in a different language return the milliseconds between the Unix Epoch time (highly compatible and available in most platforms) which you can get using the DateTime.UtcNow.ToUnixTimeMs() extension method.

Upvotes: 3

Related Questions