Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VL-FILE-SYSTIME is older than today?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
mdhutchinson
299 Views, 2 Replies

VL-FILE-SYSTIME is older than today?

VL-FILE-SYSTIME returns something like the following:

 

(2014 5 3 7 11 42 27 275)

  • Year
  • month
  • day of the week
  • day of the month
  • hours
  • minutes
  • seconds

(rtos (getvar "date") 2 10) returns something like...

"2456785.587002848"

 

What would a function look like that would return True if VL-FILE-SYSTIME falls before midnight...?

something like

 

(apply '< (list (fix (ctoj 2014 5 3 7 11 42))(fix (getvar "date"))))

 

Note: ctoj function comes from Julian.lsp

 

 

2 REPLIES 2
Message 2 of 3
Gary_J_Orr
in reply to: mdhutchinson


@mdhutchinson wrote:

VL-FILE-SYSTIME returns something like the following:

 

(2014 5 3 7 11 42 27 275)

  • Year
  • month
  • day of the week
  • day of the month
  • hours
  • minutes
  • seconds

(rtos (getvar "date") 2 10) returns something like...

"2456785.587002848"

 

What would a function look like that would return True if VL-FILE-SYSTIME falls before midnight...?

something like

 

(apply '< (list (fix (ctoj 2014 5 3 7 11 42))(fix (getvar "date"))))

 

Note: ctoj function comes from Julian.lsp

 

 


You need to skip the "day of the week" value for ctoj (it needs looks for the day of the month):

where lst = the return from the vl-file-systime function and hours, minutes, and seconds are replaced with 0's since all you want is the day
(setq lst '(2014 5 3 7 11 42 27 275))
(< (fix (ctoj (car lst) (cadr lst) (cadddr lst) 0 0 0)) (fix (getvar "date")))

 

-G

Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Message 3 of 3
Gary_J_Orr
in reply to: Gary_J_Orr

of course you could always use nth as well and put in as many values as you want without going through the ca....r contortions:

 

(<
  (fix (ctoj (nth 0 lst) (nth 1 lst) (nth 3 lst) (nth 4 lst) (nth 5 lst) (nth 6 lst)))
  (fix (getvar "date"))
  )

 

-G

Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost