Эх сурвалжийг харах

Changed milli to unixnano

Toby Chui 3 жил өмнө
parent
commit
689704f5fa
1 өөрчлөгдсөн 4 нэмэгдсэн , 3 устгасан
  1. 4 3
      file_system.go

+ 4 - 3
file_system.go

@@ -630,7 +630,7 @@ func system_fs_handleUpload(w http.ResponseWriter, r *http.Request) {
 	storeFilename := handler.Filename //Filename of the uploaded file
 
 	//Get request time
-	uploadStartTime := time.Now().UnixMilli()
+	uploadStartTime := time.Now().UnixNano() / int64(time.Millisecond)
 
 	//Update for Firefox 94.0.2 (x64) -> Now firefox put its relative path inside Content-Disposition -> filename
 	//Skip this handler logic if Firefox version is in between 84.0.2 to 94.0.2
@@ -754,9 +754,10 @@ func system_fs_handleUpload(w http.ResponseWriter, r *http.Request) {
 	//Do upload finishing stuff
 
 	//Add a delay to the complete message to make sure browser catch the return value
-	if time.Now().UnixMilli()-uploadStartTime < 100 {
+	currentTimeMilli := time.Now().UnixNano() / int64(time.Millisecond)
+	if currentTimeMilli-uploadStartTime < 100 {
 		//Sleep until at least 300 ms
-		time.Sleep(time.Duration(100 - (time.Now().UnixMilli() - uploadStartTime)))
+		time.Sleep(time.Duration(100 - (currentTimeMilli - uploadStartTime)))
 	}
 	//Completed
 	sendOK(w)