Lugaru's Epsilon
Editor 14.04

Epsilon User's Manual and Reference
   Primitives and EEL Subroutines
      . . .
      File Primitives
         File Reading Primitives
         File Writing Primitives
         Line Translation Primitives
         . . .
         Tagging Internals
      Operating System Primitives
         System Primitives
         Window System Primitives
         Calling Windows DLLs
         Running a Process
      Control Primitives
         Control Flow
         Character Types
         Examining Strings
         . . .
         Help Subroutines
      . . .

Previous   Up    Next
Printing Primitives  Primitives and EEL Subroutines   Calling Windows DLLs

Epsilon User's Manual and Reference > Primitives and EEL Subroutines > Operating System Primitives >


int time_ms()
time_begin(TIMER *t, int len)
int time_done(TIMER *t)
int time_remaining(TIMER *t)

The time_ms( ) primitive returns the time in milliseconds since some arbitrary event in the past. Eventually, the value resets to 0, but just when this occurs varies with the environment. In some cases, the returned value resets to 0 once a day, while others only wrap around after longer periods.

The time_begin( ) and time_done( ) primitives provide easier ways to time events. Both use the TIMER data type, which is built into Epsilon. The time_begin( ) primitive takes a pointer to a TIMER structure and a delay in hundredths of a second. It starts a timer contained in the TIMER structure. The time_done() primitive takes a pointer to a TIMER that has previously been passed to time_begin( ) and returns nonzero if and only if the indicated delay has elapsed. The time_remaining( ) primitive returns the number of hundredths of a second until the delay of the provided timer elapses. If the delay has already elapsed, the function returns zero. You can pass -1 to time_begin( ) to create a timer that will never expire; time_remaining( ) will always return a large number for such a timer, and time_done( ) will always return zero.

Also see the delay( ) primitive in Control Flow.

current_time_and_date(char *s)

The current_time_and_date( ) subroutine fills in the string s with the current time and date. It uses the format specified by the date-format variable.

struct time_info {
        short year;
        short month;    /* 1-12 */
        short day;      /* 1-31 */
        short hour;     /* 0-23 */
        short minute;   /* 0-59 */
        short second;   /* 0-59 */
        short hundredth;/* 0-99 */
        short day_of_week; /* 0=Sunday ... 6=Saturday */
time_and_day(struct time_info *t_info)

The time_and_day( ) primitive requests the current time and day from the operating system, and fills in the time_info structure defined above. The structure declaration also appears in eel.h.

Notice that the time_and_day( ) primitive takes a pointer to a structure, not the structure itself. Here is an example command that prints out the time and date in the echo area.

#include "eel.h"

command what_time()
    struct time_info ts;

    say("It's %d:%d on %d/%d/%d.", ts.hour, ts.minute,
                                  ts.month,, ts.year);

Previous   Up    Next
Printing Primitives  Primitives and EEL Subroutines   Calling Windows DLLs

Lugaru Epsilon Programmer's Editor 14.04 manual. Copyright (C) 1984, 2021 by Lugaru Software Ltd. All rights reserved.