Misc. Functions (XForms (Forms Library) - Version 1.2 (Rev. 4) A Graphical User Interface Toolkit for X)

Next: Windowing Support, Up: Part V Some Useful Functions [Contents][Index]

### 33.1 Misc. Functions

The following routine can be used to sound the keyboard bell (if capable):

    void fl_ringbell(int percent);

where `percent` can range from -100 to 100 with 0 being the default volume setting of the keyboard. A value of 100 indicates maximum volume and a value of -100 minimum volume (off). Note that not all keyboards support volume variations.

To get the user name who’s running the application you can use the routine

    const char *fl_whoami(void);

To get a string form of the current date and time, the following routine is available:

    const char *fl_now(void);

The format of the string is of the form `"Wed Jun 30 21:49:08 1993"`.

The following time related routine might come in handy

    void fl_gettime(unsigned long *sec, unsigned long *usec);

Upon function return `sec` and `usec` are set to the current time, expressed in seconds and microseconds since 00:00 GMT January, 1970. This function is most useful for computing time differences.

Th function

    int fl_mode_capable(int mode, int warn);

allows to determine the visual classes the system is capable of. `mode` must be one of `GrayScale`, `StaticGray`, `PseudoColor`, `StaticColor`, `DirectColor` and `TrueColor` and the function returns 1 if the system is capable of displaying in this visual class and 0 otherwise. If `warn` is set a warning is printed out in case the capability asked for isn’t available.

To find out the "depth" of the current display (basically the number of bits used for colors) use the function

    int fl_get_visual_depth(void);

Finally

    int fl_msleep(usigned long msec);

allows to wait for a number of milli-seconds (with the best resolution possible on your system).

Next: Windowing Support, Up: Part V Some Useful Functions [Contents][Index]