@@ -3206,7 +3206,7 @@ workspace->result.
3206
3206
If NO-WAIT is non-nil send the request as notification."
3207
3207
(if no-wait
3208
3208
(lsp-notify method params)
3209
- (let* ((send-time (time-to-seconds (current- time) ))
3209
+ (let* ((send-time (float- time))
3210
3210
;; max time by which we must get a response
3211
3211
(expected-time
3212
3212
(and
@@ -3228,7 +3228,7 @@ If NO-WAIT is non-nil send the request as notification."
3228
3228
(accept-process-output
3229
3229
nil
3230
3230
(if expected-time (- expected-time send-time) 1))))
3231
- (setq send-time (time-to-seconds (current- time) ))
3231
+ (setq send-time (float- time))
3232
3232
(when (and expected-time (< expected-time send-time))
3233
3233
(error "Timeout while waiting for response. Method: %s" method)))
3234
3234
(setq done? t)
@@ -3245,7 +3245,7 @@ If NO-WAIT is non-nil send the request as notification."
3245
3245
"Send request METHOD with PARAMS and waits until there is no input.
3246
3246
Return same value as `lsp--while-no-input' and respecting `non-essential'."
3247
3247
(if non-essential
3248
- (let* ((send-time (time-to-seconds (current- time) ))
3248
+ (let* ((send-time (float- time))
3249
3249
;; max time by which we must get a response
3250
3250
(expected-time
3251
3251
(and
@@ -3263,7 +3263,7 @@ Return same value as `lsp--while-no-input' and respecting `non-essential'."
3263
3263
(catch 'lsp-done
3264
3264
(sit-for
3265
3265
(if expected-time (- expected-time send-time) 1)))
3266
- (setq send-time (time-to-seconds (current- time) ))
3266
+ (setq send-time (float- time))
3267
3267
(when (and expected-time (< expected-time send-time))
3268
3268
(error "Timeout while waiting for response. Method: %s" method)))
3269
3269
(setq done? (or resp-error resp-result))
@@ -6469,6 +6469,10 @@ PARAMS are the `workspace/configuration' request params"
6469
6469
section))))))
6470
6470
(apply #'vector)))
6471
6471
6472
+ (defun lsp--ms-since (timestamp)
6473
+ "Integer number of milliseconds since TIMESTAMP. Fractions discarded."
6474
+ (floor (* 1000 (float-time (time-since timestamp)))))
6475
+
6472
6476
(defun lsp--send-request-response (workspace recv-time request response)
6473
6477
"Send the RESPONSE for REQUEST in WORKSPACE and log if needed."
6474
6478
(-let* (((&JSONResponse :params :method :id) request)
@@ -6478,7 +6482,7 @@ PARAMS are the `workspace/configuration' request params"
6478
6482
(lsp--make-log-entry method id params 'incoming-req)))
6479
6483
(resp-entry (and lsp-log-io
6480
6484
(lsp--make-log-entry method id response 'outgoing-resp
6481
- (/ (nth 2 (time- since recv-time)) 1000 )))))
6485
+ (lsp--ms- since recv-time)))))
6482
6486
;; Send response to the server.
6483
6487
(when (lsp--log-io-p method)
6484
6488
(lsp--log-entry-new req-entry workspace)
@@ -6657,7 +6661,7 @@ server. WORKSPACE is the active workspace."
6657
6661
(when (lsp--log-io-p method)
6658
6662
(lsp--log-entry-new
6659
6663
(lsp--make-log-entry method id data 'incoming-resp
6660
- (/ (nth 2 (time- since before-send)) 1000 ))
6664
+ (lsp--ms- since before-send))
6661
6665
workspace))
6662
6666
(when callback
6663
6667
(remhash id (lsp--client-response-handlers client))
@@ -6668,7 +6672,7 @@ server. WORKSPACE is the active workspace."
6668
6672
(when (lsp--log-io-p method)
6669
6673
(lsp--log-entry-new
6670
6674
(lsp--make-log-entry method id (lsp:json-response-error-error json-data)
6671
- 'incoming-resp (/ (nth 2 (time- since before-send)) 1000 ))
6675
+ 'incoming-resp (lsp--ms- since before-send))
6672
6676
workspace))
6673
6677
(when callback
6674
6678
(remhash id (lsp--client-response-handlers client))
0 commit comments