View previous topic :: View next topic |
Author |
Message |
Gyurma
Joined: 10 Mar 2005 Posts: 17 Location: Budapest
|
Posted: Mon May 07, 2007 5:14 pm Post subject: Syssec works strange |
|
|
Hi!
If the input parameter type is different (but the input time value is the same) then Syssec time is different.
For example:
Target = SYSSEC()
Target = SYSSEC(strTime, strDate) 'strtime, strdate is actual
There are some hours difference between the 2 SYSSEC time!
Does anybody know something about this? |
|
Back to top |
|
|
oe9vfj
Joined: 17 Jun 2004 Posts: 269 Location: Austria, Hard
|
Posted: Mon May 07, 2007 6:16 pm Post subject: |
|
|
Are you sure, that this two statements use same time/date parameter.
SYSSEC() uses the CLOCK variables _Sec, _Min, _Hour, _Day, _Month, _Year which are updated by the CLOCK routine.
strDATE and strTime are user-defined variables which must be filled by the user-prgram. If the values in strTime and strDate differs to _Sec .. _Year you will get different SYSSEC.
You make then to same values with
strTime = Time$
strDate = Date$
If you have further problems, please provide a code snippet, which produces the error. _________________ regards Josef
DOS - File System for BASCOM-AVR on http://members.aon.at/voegel |
|
Back to top |
|
|
Luciano
Joined: 29 Nov 2004 Posts: 3149 Location: Italy
|
Posted: Mon May 07, 2007 7:13 pm Post subject: |
|
|
Hi,
Works here. Try the sample below.
Best regards,
Luciano
Code: | $regfile = "m128def.dat"
$crystal = 4000000
$baud = 9600
$hwstack = 32
$swstack = 16
$framesize = 40
Dim strDate as String * 8
Dim strtime as String * 8
Dim lSysSec as Long
Config Clock = Soft
Config Date = Mdy , Separator = /
Date$ = "01/01/00"
Time$ = "00:00:00"
Enable Interrupts
Do
Waitms 500
Print Date$ ; Spc(3) ; Time$
lSysSec = Syssec()
Print lSysSec
Print "========================================"
Loop until lSysSec = 5
Time$ = "23:59:55"
Do
Waitms 500
Print Date$ ; Spc(3) ; Time$
lSysSec = Syssec()
Print lSysSec
Print "========================================"
Loop until lSysSec = 86399
strTime = "00:00:00"
strDate = "01/02/00"
lSysSec = SysSec(strTime , strDate)
Print lSysSec ; Spc(3) ; strDate ; Spc(3) ; strTime ; " (First second day 2)"
Print "========================================"
End |
The output:
Code: |
01/01/00 00:00:00
0
========================================
01/01/00 00:00:01
1
========================================
01/01/00 00:00:01
1
========================================
01/01/00 00:00:02
2
========================================
01/01/00 00:00:02
2
========================================
01/01/00 00:00:03
3
========================================
01/01/00 00:00:03
3
========================================
01/01/00 00:00:04
4
========================================
01/01/00 00:00:05
5
========================================
01/01/00 23:59:55
86395
========================================
01/01/00 23:59:56
86396
========================================
01/01/00 23:59:56
86396
========================================
01/01/00 23:59:57
86397
========================================
01/01/00 23:59:57
86397
========================================
01/01/00 23:59:58
86398
========================================
01/01/00 23:59:59
86399
========================================
86400 01/02/00 00:00:00 (First second day 2)
========================================
|
|
|
Back to top |
|
|
Gyurma
Joined: 10 Mar 2005 Posts: 17 Location: Budapest
|
Posted: Fri May 11, 2007 9:40 am Post subject: |
|
|
Hi!
I have user clock. I give the time values to the clock variables (_sec, _min, ...) and then make SYSSEC() and it's good now. I don't know what was the problem with the first try with StrTime and StrDate but this is good now and simple. I can compare two time value and when they are similar, SYSSEC value is also similar so it works good.
THX for the replies!
PEACE! |
|
Back to top |
|
|
|