I just wrote a simple C# Bookstore by copying the logic in the sample Php bookstore application, all looks pretty straightforward. when I click download to fulfill the book, the Adobe digital edition returns error.
I recalled in the php program, the client will pass a dateval variable to the fulfillment server, it just pick up the time() function which returns seconds since Unix epoch. so I just create my own edition like
int dataval = (int)DateTime.Now.Subtract(new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds;
then when the server get the fulfillment request , it think the time has been passed. Why?
here is the trick, the time function that the php sample program uses Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).
I am in the PST timezone, so there is 8 hours difference,
fixing is easy,change it as,
(int)DateTime.Now.ToUniversalTime().Subtract(new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds;
No comments:
Post a Comment