In AutoCAD 2017-based products, the
DATE system variables no longer store the current time down to the current millisecond which if you are getting the current date or time might not be a deal breaker for your custom programs. However, the
CDATE system variables are also used to determine how long it takes for a custom program to run or to generate unique block names/entries in a log file.
If you are using these system variables, make sure your programs don't rely on time intervals as small as milliseconds. If your custom programs do rely on milliseconds, chances are your custom programs might not be functioning as expected or could be taking longer than they did in previous releases if you are using a loop to wait for a detectable time change.
When working with time intervals as small as milliseconds, consider looking at the
MILLISECS system variable. The
MILLISECS system variable returns the time difference in which the workstation was booted until now in milliseconds. Using the
MILLISECS system variable, you could get the last 2 or 3 digits of the value and append them to the value returned by the
CDATE system variable if you want a value that is comparable to that returned in AutoCAD 2016-based products and earlier. However, if you are just tracking time differences, you might just want to migrate to using the
MILLISECS system variable instead of the
CDATE system variable.
The following is an example of a custom function named
CDATE that returns the values of the
CDATE system variables based on the release of AutoCAD being used. The function returns the value of the
CDATE system variable when executed on AutoCAD 2016-based products and earlier, and returns a value that combines the values of the
MILLISECS system variables when executed on AutoCAD 2017.
; Returns a CDATE value that includes milliseconds based on release
; Usage: (CDate)
; Replaces (rtos (getvar "CDATE") 2 8)
(defun CDate ( / ms)
; Check to see which AutoCAd release is being used
(if (< (atof (getvar "ACADVER")) 21.0)
(rtos (getvar "CDATE") 2 8)
; Get the current milliseconds and append it to the CDATE value
(setq ms (itoa (getvar "MILLISECS")))
(strcat (rtos (getvar "CDATE") 2 6)(substr ms (- (strlen ms) 2)))
Hope this helps you understand what might need to be changed with your custom programs and how you might go about making the change.
Other related articles:
- Getting the Current Date/Time with AutoLISP - Part 1
- Getting the Current Date/Time with AutoLISP - Part 2
- PSA: Additional Date Related System Variables to Be Aware Of in Custom AutoLISP Programs