gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
dc_scaledsec Module Reference

Scaled seconds module for precise time operations. More...

Data Types

type  dc_scaled_sec
interface  assignment(=)
interface  operator(==)
interface  operator(>)
interface  operator(<)
interface  operator(>=)
interface  operator(<=)
interface  operator(+)
interface  operator(-)
interface  operator(*)
interface  operator(/)
interface  mod
interface  modulo
interface  abs
interface  int
interface  sign
interface  floor
interface  ceiling

Functions/Subroutines

subroutine, public dcscaledsecputline (sclsec, unit, indent)

Detailed Description

Scaled seconds module for precise time operations.

Author
Youhei SASAKI, Yasuhiro MORIKAWA

A module for correct operations of "seconds" after the decimal point, and large number more than integer type.

This module provides the derived type DC_SCALED_SEC and operators for precise operations of time values that cannot be represented accurately by standard integer or real types.

Operators and Procedures

Operator/Procedure Description
assignment(=) Assignment
operator(+) Addition
operator(-) Subtraction
operator(*) Multiplication
operator(/) Division
mod Remainder
modulo Modulo
operator(==) Equal comparison
operator(>) Greater than comparison
operator(<) Less than comparison
operator(>=) Greater than or equal comparison
operator(<=) Less than or equal comparison
abs Absolute value
int Integer value (truncate fractional parts)
sign Set sign
floor Maximum integer not greater than given value
ceiling Minimum integer not less than given value

Function/Subroutine Documentation

◆ dcscaledsecputline()

subroutine, public dc_scaledsec::dcscaledsecputline ( type(dc_scaled_sec), intent(in) sclsec,
integer, intent(in), optional unit,
character(*), intent(in), optional indent )

Print information of DC_SCALED_SEC

Print information of sclsec. By default messages are output to standard output. Unit number for output can be changed by unit argument.

Parameters
[in]sclsecDC_SCALED_SEC variable to print
[in]unitUnit number for output. Default is standard output.
[in]indentIndent string for displayed messages

Definition at line 428 of file dc_scaledsec.f90.

429 use dc_string, only: printf, tochar
430 use dc_trace, only: beginsub, endsub
431 use dc_types, only: stdout, string
432 implicit none
433 type(DC_SCALED_SEC), intent(in) :: sclsec
434 integer, intent(in), optional :: unit
435 character(*), intent(in), optional:: indent
436
437 integer :: out_unit, sec_ary_rev(imin:imax)
438 integer:: indent_len
439 character(STRING):: indent_str
440 character(1):: sign
441 continue
442 !call BeginSub(subname)
443
444 if (present(unit)) then
445 out_unit = unit
446 else
447 out_unit = stdout
448 end if
449
450 indent_len = 0
451 indent_str = ''
452 if ( present(indent) ) then
453 if ( len(indent) /= 0 ) then
454 indent_len = len(indent)
455 indent_str(1:indent_len) = indent
456 end if
457 end if
458
459 sec_ary_rev(imin:imax) = sclsec % sec_ary(imax:imin:-1)
460 if ( sclsec % flag_negative ) then
461 sign = '-'
462 else
463 sign = '+'
464 end if
465 if ( imax - imin + 1 == 6 ) then
466 call printf(out_unit, &
467 & indent_str(1:indent_len) // &
468 & '#<DC_SCALED_SEC:: @sign=%c @yotta=%d @exa=%d @tera=%d @mega=%d @base=%d @micro=%d>', &
469 & i = sec_ary_rev, c1 = sign )
470 elseif ( imax - imin + 1 == 11 ) then
471 call printf(out_unit, &
472 & indent_str(1:indent_len) // &
473 & '#<DC_SCALED_SEC:: @sign=%c @yotta=%d @zetta=%d @exa=%d @peta=%d @tera=%d', &
474 & i = sec_ary_rev(imin:imin+4), c1 = sign )
475 call printf(out_unit, &
476 & indent_str(1:indent_len) // &
477 & ' @giga=%d @mega=%d @kilo=%d @base=%d @milli=%d @micro=%d>', &
478 & i = sec_ary_rev(imax-5:imax) )
479 else
480 call printf(out_unit, &
481 & indent_str(1:indent_len) // &
482 & '#<DC_SCALED_SEC:: @sign=%c @sec_ary=%*d>', &
483 & i = sec_ary_rev, n = (/ imax - imin + 1 /), c1 = sign )
484 end if
485 !call EndSub(subname)
Handling character types.
Definition dc_string.f90:83
Debug tracing module.
Definition dc_trace.f90:150
subroutine, public beginsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca, version)
Definition dc_trace.f90:457
subroutine, public endsub(name, fmt, i, r, d, l, n, c1, c2, c3, ca)
Definition dc_trace.f90:580
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public string
Character length for string
Definition dc_types.f90:137
integer, parameter, public stdout
Unit number for Standard OUTPUT
Definition dc_types.f90:117

References dc_trace::beginsub(), dc_trace::endsub(), dc_types::stdout, and dc_types::string.

Here is the call graph for this function: