By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,173 Members | 1,079 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,173 IT Pros & Developers. It's quick & easy.

Regarding Time conversion, secondly number comparison

P: n/a
Hi,
I am working on awk programming which is similar to C programming and
have got a doubt about time function returning a float value.
Ex: 01:01:30 should return 61.5 when i have tried my way i am not able
to get the seconds value (30/60=0.5)
So can anyone give me ideas, throught which i can do similar coding in
AWK programming.

Secondly i am comparing two number.
Ex: 91402777777 is the dialled number and the area code is 91 (Which
has got calculation needed to be done upon comparing.
When i was doing the string comparison
it was matching number 9 and putting the local rate calculations, but
the number being international.
So this is also being carried out in AWK programming.
can u give me suggestions as how number comparison and time conversion
can be carried out.
i am trying all different option, your suggestion might be the one i am
looking for but not able to get it.....
Thanks in advance...

Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Chandu wrote:
Hi,
I am working on awk programming which is similar to C programming and
have got a doubt about time function returning a float value.
Ex: 01:01:30 should return 61.5 when i have tried my way i am not able
to get the seconds value (30/60=0.5)
So can anyone give me ideas, throught which i can do similar coding in
AWK programming.
Have you considered integer division vs. floating point division?

Secondly i am comparing two number.
Ex: 91402777777 is the dialled number and the area code is 91 (Which
has got calculation needed to be done upon comparing.
When i was doing the string comparison
it was matching number 9 and putting the local rate calculations, but
the number being international.
I have not the least clue as to what you are doing, so I cannot
help you there.

So this is also being carried out in AWK programming.
can u give me suggestions as how number comparison and time conversion
can be carried out.
i am trying all different option, your suggestion might be the one i am
looking for but not able to get it.....


Why don't you ask this in an AWK newsgroup? Hint: There is comp.lang.awk
but any groups containing "lang.awk" may be helpful. Check their charter
and FAQ first and have a look at past threads before posting.

Also consider demonstrating your problems with a _minimal_ _running_
example AWK script. Your description may be inaccurate in a vital spot.
It was not helpful for me.
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Nov 15 '05 #2

P: n/a
"Chandu" <ph***************@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Hi,
I am working on awk programming which is similar to C programming and
have got a doubt about time function returning a float value.
Ex: 01:01:30 should return 61.5 when i have tried my way i am not able
to get the seconds value (30/60=0.5)
So can anyone give me ideas, throught which i can do similar coding in
AWK programming.
AWK != C, hence is OT in this group.

A few hints:
It's best to use integer time for it has no rounding problems inherent in
floating point. See for example the single unix specification (available for
free on the net) on how amount of seconds since unix epoch can be converted
to year,month,day (+day of week),hour,minute,second and backwards. There's
somewhere an example.
Secondly i am comparing two number.
Ex: 91402777777 is the dialled number and the area code is 91 (Which
has got calculation needed to be done upon comparing.
When i was doing the string comparison
it was matching number 9 and putting the local rate calculations, but
the number being international.


I'm not sure I get your problem. Is the number stored in a string or in
integer variable?
Either you need bigger integer type or proper comparison of number strings.

Alex
Nov 15 '05 #3

P: n/a
Chandu wrote on 19/09/05 :
I am working on awk programming which is similar to C programming and
Note that we are strictly speaking C here. Awk is a foreign language we
don't speak.
have got a doubt about time function returning a float value.
Ex: 01:01:30 should return 61.5 when i have tried my way i am not able
to get the seconds value (30/60=0.5)
Are we supposed to read your mind to know what is non working the
C-code you have written ?
Secondly i am comparing two number.
Ex: 91402777777 is the dialled number and the area code is 91 (Which
has got calculation needed to be done upon comparing.
When i was doing the string comparison
it was matching number 9 and putting the local rate calculations, but
the number being international.
So this is also being carried out in AWK programming.
can u give me suggestions as how number comparison and time conversion
can be carried out.
i am trying all different option, your suggestion might be the one i am
looking for but not able to get it.....


I got the feeling that you should better use a string process than a
numerical one...

Once again, awk is not spoken right there. C-only.

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

"Mal nommer les choses c'est ajouter du malheur au
monde." -- Albert Camus.
Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.