Problem with seconds

Problem with seconds

Postby Silvio.Falconi » Mon Nov 19, 2012 3:15 pm

I -have
nOreToriche:=150
nSecFlNeg:=3720

nSecTeoriche:=( nOreToriche*60)*60

nOrePresenza:=INT(( (nSecTeoriche-nSecFlNeg) /60)/60 )

but this operation Give me 148.00

if I not use INT it give me 148.97

while it must give me 148:58 ... because I must write to format Hour and not decimal


how I must make ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem with seconds

Postby StefanHaupt » Mon Nov 19, 2012 4:07 pm

nOrePresenza:= (nSecTeoriche-nSecFlNeg) /60/60
nMin := Int ( nOrePresenza *60/100)

cHour := Str ( Int(nOrePresenza), Lennum (Int(nOrePresenza)) )
cMin := StrZero (nMin,2))

cTime := cHour+":"+cMin

gives you 148:58
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: Problem with seconds

Postby Silvio.Falconi » Mon Nov 19, 2012 4:30 pm

StefanHaupt wrote:nOrePresenza:= (nSecTeoriche-nSecFlNeg) /60/60
nMin := Int ( nOrePresenza *60/100)

cHour := Str ( Int(nOrePresenza), Lennum (Int(nOrePresenza)) )
cMin := StrZero (nMin,2))

cTime := cHour+":"+cMin

gives you 148:58



strange give me 148:89

see it please
Image



dDate:= "01/09/2012"

nGiornimese:= nDaysMonth( dDate )
nDomenicheMese:=GetSundays( nMese, val(nAnno) ) give me the number od sundays on a mounth

nOreToriche :=(nGiornimese*6)-(nDomenicheMese*6) give me 150

nSecTeoriche:=( nOreToriche*60)*60

nOrePresenza:= (nSecTeoriche-nSecFlNeg) /60/60
nMinPresenza := Int ( nOrePresenza *60/100)
cHourPresenza := Str ( Int(nOrePresenza), Lennum (Int(nOrePresenza)) )

cMinPresenza := StrZero (nMinPresenza,2) give me 89

cTimePresenza := cHourPresenza+":"+cMinPresenza

give me 148:89
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Problem with seconds

Postby Silvio.Falconi » Mon Nov 19, 2012 5:10 pm

Found error

nMinPresenza := INT(MOD((nSecTeoriche-nSecFlNeg)/ 60, 60))

NOw give me 148:58 RIGHT !!!
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 52 guests