The time stamp of Wechat's JSSDK signature

according to the description in the 1-JS-SDK usage permission signature algorithm in Appendix JS-SDK of Wechat JS-SDK ( URL is here ), a signature needs to be calculated when using jssdk, and a timestamp needs to be provided when calculating the signature.

The

code is Cmursharp. As far as I understand it, a timestamp is a number, but it is found that not all numbers can be used as timestamps. The conclusions of current observation are as follows:

DateTime.Now.ToFileTime ()
No

DateTime.Now.ToFileTime () / 10000
can

DateTime.Today.ToFileTime ()
can

but the document does not say what kind of numbers are not allowed. I don"t know if there are any brothers who know.


4-byte digits can be used for timestamping (up to 10 digits of decimal length)
several of the methods you send return values that are too long


this is recommended:

TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
return Convert.ToInt64(ts.TotalSeconds).ToString();
Menu