Issue 22438 - StarBasic Function Second returns wrong results
Summary: StarBasic Function Second returns wrong results
Status: CLOSED FIXED
Alias: None
Product: Calc
Classification: Application
Component: code (show other issues)
Version: OOo 1.1
Hardware: PC Linux, all
: P3 Trivial (vote)
Target Milestone: ---
Assignee: ab
QA Contact: issues@sc
URL:
Keywords: oooqa
Depends on:
Blocks:
 
Reported: 2003-11-13 17:07 UTC by Unknown
Modified: 2013-08-07 15:12 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Three macros to demonstrate Second, Minute, Hour bugs (7.08 KB, application/vnd.sun.xml.writer)
2004-01-08 20:08 UTC, bmarcelly
no flags Details
Rev 2 of my macros, showing the bug and a Basic solution (10.26 KB, application/vnd.sun.xml.writer)
2004-01-09 13:14 UTC, bmarcelly
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Unknown 2003-11-13 17:07:59 UTC
I am using OpenOffice 1.1.0 (german localization) and found following bug in the
spreadsheet application

if I use the function Sekunde (second) for time like 00:00:00, 00:00:01, ...) I
get the expected results (0, 1, ...)

If I write a StarBasic Macro and which basically is
Function mySecond(aTime)
  s = Second(aTime)
  mySecond = s
End Function

the input data 00:00:00, 00:00:01, 00:00:02, ... 00:00:59, 00:01:00, 00:01:01
leads to following results 0, 0, 1, ... 58, 0, 0 which looks wrong to me.
Comment 1 frank 2003-11-14 09:32:52 UTC
Hi Andreas,

JSK said it's your construction site.

So please have a look.

Frank
Comment 2 frank 2003-11-14 09:33:29 UTC
Uuuuppppssss,

Prio to high and target set

Frank
Comment 3 ab 2003-11-14 09:50:22 UTC
AB->SWITO:

Sorry, I cannot reproduce this. On my system I get:

  msgbox Second( "00:00:00" ) -> 0
  msgbox Second( "00:00:01" ) -> 1
  msgbox Second( "00:00:02" ) -> 2

Or what exactly was your input? You wrote "for input data 00:00:00...",
but in which format/type? Maybe you can provide a complete example.
Comment 4 bmarcelly 2004-01-08 20:05:09 UTC
This routine shows that Basic function Second is not working:
Sub MainS
Dim x As Long, y As Long, y2 As Long, z1 As Date
for x = 0 to 59
  z1 = TimeSerial(12, 30, x)
  y = Second(z1)
  y2= CLng(CDbl(z1)*86400) Mod 60
  if x<>y then print "Second   " & x, y, y2
next
End Sub

This Sub displays only incorrect values for y. 
The calculation with y2 retrieves the correct value.

The same problem appears with functions Minute and Hour.
Comment 5 bmarcelly 2004-01-08 20:08:10 UTC
Created attachment 12367 [details]
Three macros to demonstrate Second, Minute, Hour bugs
Comment 6 maison.godard 2004-01-09 08:25:28 UTC
Hi,

I don't think this is related to speadsheet project ?
Can we change the target component to say ... udk ?

Laurent
Comment 7 frank 2004-01-09 09:34:14 UTC
Reassigned as new info was introduced.

Farnk
Comment 8 bmarcelly 2004-01-09 13:14:48 UTC
Created attachment 12376 [details]
Rev 2 of my macros, showing the bug and a Basic solution
Comment 9 ab 2004-01-16 10:11:51 UTC
Ok, I can reproduce the problem -> Started
Comment 10 b.osi.ooo 2004-05-18 14:58:23 UTC
According to the roadmap of  OpenOffice.org 2.0
(http://tools.openoffice.org/releases/q-concept.html) this
issue has been scheduled for 3.0. 
Comment 11 bmarcelly 2005-07-09 09:26:04 UTC
Today I have run again the macro in Module2 of SecMinHoursBugV2.sxw 
The macro works OK in OOo 1.1.4 and OOo 1.9.113 which means the functions Second 
Minute and Hour are now correct.

Apparently someone has corrected the bug without updating this issue. Can a developer 
check this and change Issue status and Target Milestone?
Comment 12 ab 2005-07-13 10:29:10 UTC
I also cannot reproduce this task any more. Probably this fix is a
side effect from another fix. -> Set to FIXED
Comment 13 ace_dent 2008-05-17 21:41:02 UTC
The Issue you raised has been marked as 'Resolved' and not updated within the
last 1 year+. I am therefore setting this issue to 'Verified' as the first step
towards Closing it. If you feel this is incorrect, please re-open the issue and
add any comments.

Many thanks,
Andrew
 
Cleaning-up and Closing old Issues
~ The Grand Bug Squash, pre v3 ~
http://marketing.openoffice.org/3.0/announcementbeta.html
Comment 14 ace_dent 2008-05-17 23:45:23 UTC
As per previous posting: Verified -> Closed.
A Closed Issue is a Happy Issue (TM).

Regards,
Andrew