Récupérer Seconde avec 100eme

Bonjour la team,

J'ai un souci avec cette façon de procéder:

Second(Now) + (Right(Format(Timer, "#0.00"), 2) / 100)

Parfois ce n'est pas exact, on dirait que ça ne se fait pas dans le "même temps" vu que je n'utilise pas la même méthode.

Il faudrait que j'arrive à faire un truc de ce style:

Dim TOTO As Date
TOTO = Timer
Second(TOTO) + (Right(Format(TOTO, "#0.00"), 2) / 100)

Mais bien sur ça ne marche pas

Ou bien un Format du timer qui me donne la seconde ET le centième.

Je tourne en rond, j'ai testé pas mal de trucs, si quelqu'un a une idée je suis preneur !!

Un grand merci pour l'aide

Bonjour

Tu trouveras certainement de l'aide là

Creer un chrono avec les centièmes de seconde (excel-pratique.com)

A+ François

bonjour,

Dim TOTO  As Double, TOTO1
     TOTO = Timer Mod 60 + Format(Timer - Fix(Timer), ".00")     'methode 1, arrondi
     TOTO1 = Timer - Fix(Timer) + Timer Mod 60     'methode2,non-arrondi
     MsgBox TOTO1 & vbLf & TOTO & vbLf & Format(Now, "hh:mm:ss")

Bonjour à tous les 2 et merci pour ces réponses.

@BsAlv: Une bonne idée, en modifiant pour garder le même appel du Timer, ça fonctionne super, merci !!

    Dim TOTO As Date
    TOTO = Timer
    MsgBox TOTO Mod 60 + Format(TOTO - Fix(TOTO), ".00")

@fanfan38: Effectivement j'ai trouvé en modifiant comme ceci pour pouvoir calculer avec le résultat:

Val(Application.WorksheetFunction.Text([Now()], "ss.00"))

Les 2 fonctionnent, j'avoue avoir une préférence pour la deuxième, plus bref

Si jamais, c'était pour "fixer" les bugs de ma trotteuse sur ma montre Seiko SNKP27 (j'ai la vraie)

Un grand merci !!!

0snkp27.zip (506.78 Ko)
capture

Edit: je n'arrive pas à passer le sujet en RESOLU sorry

bonjour, le plus court, c'est un critère discutable parce que la formule a besoin d'un "evaluate"

En temps d'exécution les différences sont microscopiques (avec un boucle de 100.000 fois), mais je préfère TOTO3 (non-arrondi) ou TOTO1 (arrondi).

Mais pourquoi ne pas calculer avec timer en direct, cela est 0 ?

Sub Temps()
     t = Timer
     For i = 1 To 100000
          a = Val(Application.WorksheetFunction.Text([Now()], "ss.00"))     'avec evaluate
     Next
     t1 = Timer

     For i = 1 To 100000
          toto1 = Timer Mod 60 + Format(Timer - Fix(Timer), ".00")     'methode 1, arrondi
     Next
     t2 = Timer

     For i = 1 To 100000
          toto2 = WorksheetFunction.Floor_Math(Timer - Fix(Timer) + Timer Mod 60, "0.01")    'methode2, arrondi
     Next

     t3 = Timer

     For i = 1 To 100000
          toto3 = Timer - Fix(Timer) + Timer Mod 60    'methode3, non-arrondi
     Next
     t4 = Timer

For i = 1 To 100000
          toto4 = Timer
     Next
     t5 = Timer

     MsgBox "toto4 : " & Format(t5 - t4, "0.000") & vbLf & "toto3 : " & Format(t4 - t3, "0.000") & vbLf & "toto2 : " & Format(t3 - t2, "0.000") & vbLf & "toto1 : " & Format(t2 - t1, "0.000") & vbLf & "[now()] : " & Format(t1 - t, "0.000")
     MsgBox a & vbLf & toto1 & vbLf & toto2 & vbLf & toto3 & vbLf & toto4

End Sub
Rechercher des sujets similaires à "recuperer seconde 100eme"