Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I get Timeval? 2

Status
Not open for further replies.

aaiqbal

Programmer
Sep 15, 2003
26
US
I know there's a variable called timeval which stores the system time. The problem is that I can't store that value in another variable using an assignment. Is there a different way? I'm defining a long called StartTime. Then I assign StartTime = timeval, but the compiler doesn't recognize timeval.
 
The system variable $LTIME is probably what you are looking for. Here is what the help file says about it:

A long value of type timeval representing the number of seconds between midnight of January 1, 1970 and the current system time and date.

You can use this variable with the various date and time commands to perform any calculation you need.


aspect@aspectscripting.com
 
I don't know if this helps but this script is from
the Help Files, and shows how to get the Julian Date.

proc main
integer LeapYear ; State of leap year.
integer DayYear, DayWeek ; DOY and DOW.
string WeekDay, Leap ; Day and leap state.
string DayStr ; Display date info.

; Get the day of the week, day of the year,
; and state of leap year. Leap year is a 0 or 1 value.

ltimemisc $LTIME DayWeek DayYear LeapYear

weekdaystr DayWeek WeekDay ; Get DOW in string format.

if LeapYear ; See if it's a leap year and if
Leap = "is" ; so, adjust string
else ; If it's not a leap year
Leap = "is not"
endif

; Create string containing day of week and leap year info
; and display it to user.

strfmt DayStr "Today is Julian Day: %d." DayYear
usermsg DayStr

endproc

Hank
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top