I'm doing these webrequests loops and I need to keep track of time (unix time) elapsed since first request. For ex:
Dim post1 String = "http://www.xxx.com/......" & UnixTimeNow1stCall & "......"
Dim postReq1 As HttpWebRequest = DirectCast(WebRequest.Create(post1), HttpWebRequest)
Dim post2 String = "http://www.xxx.com/......" & UnixTimeElasped1stCall& "......"
Dim postReq2 As HttpWebRequest = DirectCast(WebRequest.Create(post2), HttpWebRequest)
Dim post3 String = "http://www.xxx.com/......" & UnixTimeElasped1stCall& "......"
Dim postReq3 As HttpWebRequest = DirectCast(WebRequest.Create(post3), HttpWebRequest)
*LOOP again*
And so on. In other words, I need to lock the current Unix Time in the first call and whenever I call later (in spaces of 10 seconds), I need it to reference this first call.
Using this to calculate current Unix time:
Public Function UnixNow() As Long
Dim _TimeSpan As TimeSpan = (DateTime.UtcNow - New DateTime(1970, 1, 1, 0, 0, 0)) Return CLng(_TimeSpan.TotalSeconds) End Function
Whenever I call UnixTime is giving me the current time, so result is always 0. Any hints?