DATE and CDATE in 2017

DATE and CDATE in 2017

rkmcswain
Mentor Mentor
1,919 Views
11 Replies
Message 1 of 12

DATE and CDATE in 2017

rkmcswain
Mentor
Mentor

For me, these system variables return different values in 2017 than they do in earlier versions.

Can I get help verifying this?

 

Using this bit of code

 

(progn
  (setvar "dimzin" 0)
  (repeat 100
    (princ
      (strcat
	"\n"
	(rtos (getvar "date") 2 12)
      )
    )
  )
  (princ)
)

In 2017 I generally get the same exact answer for all 100 replies, which means if you subtract the last reply from the first, the net elapsed time = 0.0.

In earlier versions, the 100 answers almost all vary and the difference between the first and last is about 0.000000914 (presumably, the time it takes to process this code)

 

Why does this matter? Using the function below, note the responses from 2016 and earlier, compared to 2017.

 

(defun C:foo ()
  (defun gettime ()
    (setq s (getvar "DATE"))
    (setq seconds (* 86400.0 (- s (fix s))))
  )
  (setq begin (gettime))
  ; introduce a delay so we have something to time
  (command "._delay" 500)
  (setvar "dimzin" 0)
  (princ (strcat "\n" (rtos (- (gettime) begin) 2 12)))
  (princ)
)

----

 

;;; Response in 2016 and earlier = approx 0.5 seconds, which is expected

Command: FOO
0.502994656563
Command: FOO
0.505006313324
Command: FOO
0.502994656563
Command: FOO
0.505006313324
Command: FOO
0.504000484943
Command: FOO
0.505971908569
Command: FOO
0.501988828182

---

 

Response in 2017 = 0.0 or 1.0 seconds, everytime. Why?

Command: FOO
0.999994575977
Command: FOO
0.000000000000
Command: FOO
0.999994575977
Command: FOO
0.000000000000
Command: FOO
0.000000000000
Command: FOO
0.999994575977
Command: FOO
0.999994575977
Command: FOO
0.000000000000
Command: FOO
0.000000000000

What am I missing here? Is there another sysvar I'm overlooking that would have this effect?

 

TIA.

 

 

R.K. McSwain     | CADpanacea | on twitter
Accepted solutions (1)
1,920 Views
11 Replies
Replies (11)
Message 2 of 12

rkmcswain
Mentor
Mentor

@BlackBox_ - do you have 2017? Can you verify this if you have a minute or two? Thanks.

R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 3 of 12

BlackBox_
Advisor
Advisor

@rkmcswain wrote:

@BlackBox_ - do you have 2017? Can you verify this if you have a minute or two? Thanks.


Hi @rkmcswain -

 

I do... Err... I did; reinstalling it now.

 

Cheers

 

 

 

[Edit] - always forget the '@' malarkey. Haha


"How we think determines what we do, and what we do determines what we get."

Sincpac C3D ~ Autodesk Exchange Apps

0 Likes
Message 4 of 12

BlackBox_
Advisor
Advisor

@rkmcswain - 

 

From console; here's what I get in 2016:

 

_$ (bench '(C:FOO) '() 10)

C:FOO
0.520978868008
0.507017970085
0.507983565331
0.506977736950
0.509995222092
0.507017970085
0.507983565331
0.508989393711
0.508023798466
0.508989393711
Elapsed: 5844
Average: 584.4000

 

 

... Here's what I get in 2017:

_$ (bench '(c:FOO) '() 10)

C:FOO
0.999994575977
0.000000000000
0.999994575977
0.000000000000
0.999994575977
0.000000000000
0.999994575977
0.000000000000
0.999994575977
0.000000000000
Elapsed: 5078
Average: 507.8000

 

... So, it looks as though Autodesk has actually increased performance, and made it completely inconsistent. Haha


"How we think determines what we do, and what we do determines what we get."

Sincpac C3D ~ Autodesk Exchange Apps

0 Likes
Message 5 of 12

rkmcswain
Mentor
Mentor

Thank you. See how 2017 always returns either 0.0 or 1.0 (rounded)?

Somebody broke something.... 

 

@BlackBox_

R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 6 of 12

BlackBox_
Advisor
Advisor

@rkmcswain wrote:

Thank you. See how 2017 always returns either 0.0 or 1.0 (rounded)?

Somebody broke something.... 

 

@BlackBox_


You're welcome, @rkmcswain; I'm always happy to not help. Haha 

 

 

Cheers


"How we think determines what we do, and what we do determines what we get."

Sincpac C3D ~ Autodesk Exchange Apps

0 Likes
Message 7 of 12

rkmcswain
Mentor
Mentor
So now I need an alternative for my timers in 2017.... thoughts?

R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 8 of 12

rkmcswain
Mentor
Mentor

Answer received.

 

known81.png

 

 

 

R.K. McSwain     | CADpanacea | on twitter
Message 9 of 12

BlackBox_
Advisor
Advisor

Best I can suggest, is to take the average.

 

 

Not to mention, if this is a known issue, where is that documented, so as to not leave users/developers in the lurch?

 

Or is this only a known issue, now that you've pointed it out?


"How we think determines what we do, and what we do determines what we get."

Sincpac C3D ~ Autodesk Exchange Apps

0 Likes
Message 10 of 12

rkmcswain
Mentor
Mentor
@BlackBox_ wrote:

Not to mention, if this is a known issue, where is that documented, so as to not leave users/developers in the lurch?

Or is this only a known issue, now that you've pointed it out?

I know those were rhetorical questions, but I feel the need to answer.

 

1. I don't know.

2. I don't know.

R.K. McSwain     | CADpanacea | on twitter
0 Likes
Message 11 of 12

BlackBox_
Advisor
Advisor

@rkmcswain wrote:
@BlackBox_ wrote:

Not to mention, if this is a known issue, where is that documented, so as to not leave users/developers in the lurch?

Or is this only a known issue, now that you've pointed it out?

I know those were rhetorical questions, but I feel the need to answer.

 

1. I don't know.

2. I don't know.


Perhaps you're right.

 

I know that Autodesk doesn't really like folks asking difficult questions (and I get that), but still; It would be greatly appreciated if Autodesk were to answer.

 

 

 

Cheers


"How we think determines what we do, and what we do determines what we get."

Sincpac C3D ~ Autodesk Exchange Apps

0 Likes
Message 12 of 12

rkmcswain
Mentor
Mentor
Accepted solution
Thanks to @LeeAmbrosius for pointing out the undocumented (at the time) sysvar MILLISECS. It is documented for 2018 ! We can use this to measure time in milliseconds again. More info here.
R.K. McSwain     | CADpanacea | on twitter
0 Likes