help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Time Stamps


From: Tapani Tarvainen
Subject: Re: Time Stamps
Date: Mon, 17 Jan 2022 09:26:57 +0200

On Sun, Jan 16, 2022 at 11:51:33PM +0100, fatiparty--- via (help-bash@gnu.org) 
wrote:

> Time stamps in microseconds frequently show as 1642373395.656700
> 
> Some have pointed out that a comma ',' rather than '.' is sometimes used.
> Are there any other characters that could show up?

Other decimal separators are not used with so-called Arabic numerals
in practice anywhere as far as I know, and according to ISO 80000-1
"The decimal sign is either a comma or a point on the line."

However, with the numerals actually used in modern Arabic in many
countries, so-called Eastern Arabic numerals, a different character,
"Arabic decimal separator" (٫‎) is used (Unicode U+066B).

You can get the decimal separator of current locale with

locale decimal_point

and in scripts often it's convenient to do

eval $(locale -k decimal_point)

which saves it in $decimal_point.

In scripts where I need to extract integer and fractional parts from
numbers I often use [[:punct:]] to catch the decimal separator, if
it is already known that it's a number and that it doesn't have
thousands separators.

-- 
Tapani Tarvainen



reply via email to

[Prev in Thread] Current Thread [Next in Thread]