      subroutine calibremenu
      INCLUDE 'Parametres.f'
      real*8 s1,s2
c
      nloosetime = 500
      ttt = .2
c
      do i=1,20
        call temps(s1,is1)
        call perddutempsold(ttt)
        call temps(s2,is2)
Cfj        ss = s2-s1
cc        print*,i,nloosetime,ss
Cfj        if (ss.eq.0.d0) then
Cfj          nloosetime = nloosetime*10
Cfj        elseif(ss.ge.ttt) then
Cfj          nloosetime = nint(real(nloosetime)/ss)
Cfj          goto 9999
Cfj        elseif(ss.ge..13) then
Cfj          nloosetime = nloosetime*2
Cfj        else
Cfj          nloosetime = nloosetime*4
Cfj        endif
        millieme = is2-is1
        if (millieme.eq.0) then
          nloosetime = nloosetime*10
        elseif(millieme.ge.ttt) then
          nloosetime = nint(real(nloosetime*1000)/real(millieme))
          goto 9999
        elseif(millieme.ge.130) then
          nloosetime = nloosetime*2
        else
          nloosetime = nloosetime*4
        endif
      enddo
 9999 continue
Cfj      if (albion) then
Cfj        print*,'Delay loop =',nloosetime
Cfj      else
Cfj        print*,'Boucle d''attente =',nloosetime
Cfj      endif
      end
c--------------------------------
      subroutine perddutempsold(ttt)
      INCLUDE 'Parametres.f'
      xx = xloosetime
      n = max(1,nint(real(nloosetime)*ttt))
      do i=1,n
        do j=1,1000
          yy = 123456789.*log(1.+abs(cos(xx)))
          xx = 9876543.*sin(3456789.*cos(yy))
        enddo
      enddo
      xloosetime = xx
      end
