replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Is CONVDATE@ working ?
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Is CONVDATE@ working ?

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
DanRRight



Joined: 10 Mar 2008
Posts: 2923
Location: South Pole, Antarctica

PostPosted: Sat Oct 03, 2009 7:52 pm    Post subject: Is CONVDATE@ working ? Reply with quote

Gives message "date out of range"

Where is utility which gives seconds since 1970?

I basically need some date and time routine which returns day of the week
Back to top
View user's profile Send private message
IanLambley



Joined: 17 Dec 2006
Posts: 506
Location: Sunderland

PostPosted: Sun Oct 04, 2009 12:05 pm    Post subject: Reply with quote

Dan,

Try this
Code:

       SUBROUTINE SECONDS_SINCE_1970(iseconds)
       REAL*8 DR
       call SECONDS_SINCE_1980@(DR)
       iseconds = dr + 315489599
       end


I just wrote a program to call seconds_since_1980@ and added on an increment to the returned seconds until convdate@ gave today's date and that was 31548599 seconds.

Regards

Ian
Back to top
View user's profile Send private message Send e-mail
DanRRight



Joined: 10 Mar 2008
Posts: 2923
Location: South Pole, Antarctica

PostPosted: Sun Oct 04, 2009 7:29 pm    Post subject: Reply with quote

Thanks for respond from which I've got the idea that convdate@ is somehow working.

(But holly s@^&*t, unbelievable, i've lost several hours to get workaround for this routine and the reason is so dumb: the integer arguments for convdate@ are two byte integers which of course I've not expected! My request to Paul & all at Silverfrost - please remove all integer*2 arguments from all your utilities. It is noticeable amount of pain everyone who use them suffered if they use these compilers for 20 years. Nobody expects integer*2 for any reason, or cares to save several bytes of memory and hence these utilities are always source of errors, confusions and headache to declare them in each subroutine. Exclusion could be done only to 1-2 utilities which specifically handle bitmaps where for RGB even integer*1 are needed but there it is clear why short integers are needed since bitmaps could be hundreds of MB in size)

The convdate@ with that integer*2 arguments and your workaround gives me though some error telling today is Saturday which would be nice but unfortunately it is Sunday already Sad So please check these additional seconds in 10 years.

I've made such workaround to get day of the week
Code:
  real*8 dsecs1980
  call SECONDS_SINCE_1980@(dsecs1980)
  Weeks=(dsecs1980+86400*2)/(86400*7)
  idayOfWeek = (Weeks-int(Weeks))*7.


idayOfWeek : 0 -Sunday, 1 -Monday ...6 - Saturday


Last edited by DanRRight on Mon Oct 05, 2009 4:34 am; edited 2 times in total
Back to top
View user's profile Send private message
IanLambley



Joined: 17 Dec 2006
Posts: 506
Location: Sunderland

PostPosted: Sun Oct 04, 2009 9:54 pm    Post subject: Reply with quote

Dan,

Sorry, I might have got that a little wrong. My new estimate is 315532800.

There may also be a difference due to your time difference, so you could try moving to London and trying it again. Or run the following badly written code:
Code:

winapp
CHARACTER*30 DATE, TIME, ZONE
INTEGER*4  VALUES(8),idate,itoday,itoday_seconds
INTEGER*2 IDW,IDAY,IMONTH,IYEAR
real*8 dr
!find today's date
call DATE_AND_TIME(DATE, TIME, ZONE, VALUES)
!calculate today's date as an integer of the form yyyymmdd
itoday = (values(1)*100+values(2))*100+values(3)
Print *,'Today''s date             ',itoday
print *,'UTC time difference      ',values(4),' minute',values(4)*60,'second'
call SECONDS_SINCE_1980@(DR)
itoday_seconds = (VALUES(5)*60+VALUES(6))*60+VALUES(7)
!find the start of today
Print *,'Seconds passed today     ',itoday_seconds
iseconds            = dr - itoday_seconds
iadditional_seconds = 0
increment           = 3600
10 continue
idate_test = 0
do while(idate_test .ne. itoday)
  iadditional_seconds = iadditional_seconds + increment
  nseconds = iseconds + iadditional_seconds
  call convdate@(nseconds,IDW,IDAY,IMONTH,IYEAR)
  idate_test = (iyear*100+imonth)*100+iday
enddo
if(increment .eq. 3600)then
!just jumped and hour into the target day so jump back and increment in seconds
  iadditional_seconds = iadditional_seconds - increment
  increment = 1
  goto 10
endif
print *,'Additional seconds       ',iadditional_seconds
print *,'Seconds to start of today',nseconds,' from 1970'
Print *,'Today''s test date        ',idate_test

end

Actually, what was wrong was that I forgot to subtract the number of seconds that had passed today in this test program. That meant that it thought that today started at about 12:00. Please try it and see if you get the same result.

Ian
Back to top
View user's profile Send private message Send e-mail
Robert



Joined: 29 Nov 2006
Posts: 457
Location: Manchester

PostPosted: Sun Oct 04, 2009 10:46 pm    Post subject: Reply with quote

Yep, library code agrees Smile

Code:
      SUBROUTINE SECONDS_SINCE_1970@(DR)
      REAL*8 DR
      call SECONDS_SINCE_1980@(DR)
      dr=dr+315532800d0
      end
Back to top
View user's profile Send private message Visit poster's website
DanRRight



Joined: 10 Mar 2008
Posts: 2923
Location: South Pole, Antarctica

PostPosted: Mon Oct 05, 2009 3:10 pm    Post subject: Reply with quote

Yes, that works fine on opposite side of the earth
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group