Jump to content

How to get a system time in HScript?


Recommended Posts

Hi guys!

I have one question: how i can get system time from HScript? I want to get start time and end time of any animation and calculate average fps of system.

I thought what backward quotes must work in Houdini like in Perl but it's not working (at least in the Windows)! :( (see below)

set start_time = `system(time /T)`;

Who can answer on question: how to get system time and assign it to variable? :-(

Link to comment
Share on other sites

the unix command from hscript lets you run shell commands, for example

unix date

would work but houdini isn't aware of whatever the date command outputs.

still you can do a

unix "echo %TIME% > c:/temp/start_time.txt"

play the animation, blah blah then

unix "echo %TIME% > c:/temp/stop_time.txt"

or append with >>

(the double quotes are there to prevent hscript from interpreting anything inside them, well i think variable expansion would happen)

do the rest in perl and call it again using the unix command like

unix perl blah.pl

hum well i'm sure there are 10^6 better ways to do it

Link to comment
Share on other sites

  • 17 years later...
  • 2 years later...
On 8/22/2020 at 12:45 PM, hved said:

YYMMDD format

`substr(system("cmd /C date /T"), 12, 2)``substr(system("cmd /C date /T"), 4, 2)``substr(system("cmd /C date /T"), 7, 2)`


This is great!! Have been looking for this for a while now!! Is it possible to add current time in hours and minutes as well? :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...