HELPLIB.HLB  —  DECdts  utc_mulftime
    Multiplies a relative binary timestamp by a floating-point value.

    Format

      #include <utc.h>

      int utc_mulftime(*result, *utc1, factor)

         utc_t *result;
         const utc_t *utc1;
         const double factor;

1  –  Parameters

    Input

 utc1

    Relative binary timestamp.

 factor

    Real scale factor (double-precision floating-point)

    Output

 result

    Resulting relative binary timestamp.

2  –  Description

    The Multiply a Relative Time by a Real Factor routine multiplies
    a relative binary timestamp by a floating-point value. Either
    or both may be negative; the resulting relative binary timestamp
    has the appropriate sign. The unsigned inaccuracy in the relative
    binary timestamp is also multiplied by the absolute value of the
    floating-point value.

3  –  Returns

     0   Indicates that the routine executed successfully.
    -1   Indicates an invalid time argument or invalid results.

4  –  Example

    The following example scales and prints a relative time.

    utc_t       relutc, scaledutc;
    struct tm   sacledreltm;
    char        timstr[UTC_MAX_STR_LEN];

    /*
     * Assume relutc contains the time to scale.
     * Scale it by a factor of 17...
     */

    utc_multime(&scaledutc,          /* Out: Scaled rel time     */
                &relutc,             /* In:  Rel time to scale   */
                17L);                /* In:  Scale factor        */

    utc_ascreltime(timstr,           /* Out: ASCII rel time      */
                   UTC_MAX_STR_LEN,  /* In:  Length of input str */
                   &scaledutc);      /* In:  Rel time to convert */

    printf("%s\n",timstr);

    /*
     *   Scale it by a factor of 17.65...
     */

    utc_mulftime(&scaledutc,         /* Out: Scaled rel time     */
                 &relutc,            /* In:  Rel time to scale   */
                 17.65);             /* In:  Scale factor        */

    utc_ascreltime(timstr,           /* Out: ASCII rel time      */
                   UTC_MAX_STR_LEN,  /* In:  Input str length    */
                   &scaledutc);      /* In:  Rel time to convert */

    printf("%s\n",timstr);

    /*
     *    Convert it to a tm structure and print it.
     */

    utc_reltime(&scaledreltm,        /* Out: Scaled rel tm       */
                (long *)0,           /* Out: Scaled rel nano-sec */
                (struct tm *)0,      /* Out: Scaled rel inacc tm */
                (long *)0,           /* Out: Scd rel inacc nanos */
                &scaledutc);         /* In:  Rel time to convert */

    printf("Approximately %d days, %d hours and %d minutes\n",
     scaledreltm.tm_yday, scaledreltm.tm_hour, scaledreltm.tm_min);

5  –  Related Functions

    utc_multime
Close Help