pb sur @Now

Forum destiné aux questions sur le développement : Formules, LotusScript, Java ...

pb sur @Now

Messagepar asx9 » 22 Juil 2003 à 09:42

la formule @Now permet de relever la date et l'heure de l'ordinateur.Y'a-t-il un moyen de récupérer la date et l'heure du réseau?
asx9
 

Re: pb sur @Now

Messagepar Stephane Maillard » 22 Juil 2003 à 09:49

Bonjour,Je ne crois pas que ce soit possible en dessous de la version 6 du client.[%sig%]
Cordialement

Stéphane Maillard
Avatar de l’utilisateur
Stephane Maillard
Lord of DominoArea
Lord of DominoArea
 
Message(s) : 8695
Inscrit(e) le : 16 Déc 2004 à 01:10
Localisation : Bretagne

Re: pb sur @Now

Messagepar Stephane Maillard » 22 Juil 2003 à 09:51

Re,C'est l'heure du serveur Domino, l'heure du serveur de fichier ou controleur de domaine ?[%sig%]
Cordialement

Stéphane Maillard
Avatar de l’utilisateur
Stephane Maillard
Lord of DominoArea
Lord of DominoArea
 
Message(s) : 8695
Inscrit(e) le : 16 Déc 2004 à 01:10
Localisation : Bretagne

Re: pb sur @Now

Messagepar asx9 » 22 Juil 2003 à 10:02

je dois faire des stats concernant des temps de traitement de docs de ma base lotus notes (V4.6). Le pb c'est que mes utilisateurs n'ont pas la même heure sur leur poste (il y a jusqu'à 2h d'écart!!!). C'est pourquoi il faut que je relève une heure plus "commune".Est-ce possible ou je dois me faire une raison (et demander au service informatique de régler les postes correctement)?
asx9
 

Re: pb sur @Now

Messagepar Stephane Maillard » 22 Juil 2003 à 10:27

Re,Je viens de trouvé ceci en VB, je vais voir si cela fonctionne en LotusScript :Private Type TIME_OF_DAY_INFO tod_elapsedt As Long 'the number of seconds _ since 00:00:00, January 1, 1970. tod_msecs As Long 'the number of milliseconds _ from an arbitrary starting point _ (system reset). tod_hours As Long 'current hour (0-23) tod_mins As Long 'current minute (0-59) tod_secs As Long 'current second (0-59) tod_hunds As Long 'the current hundredth second (0-99). tod_timezone As Long 'TZ of Server in Minutes from GMT tod_tinterval As Long 'time interval for each tick of the _ clock. Each integral integer _ represents one ten-thousandth _ second (0.0001 second). tod_day As Long 'the day of the month (1-31). tod_month As Long 'the month of the year (1-12). tod_year As Long 'Specifies the year. tod_weekday As Long 'the day of the week; 0 is SundayEnd TypePrivate Declare Function apiNetRemoteTOD Lib "netapi32" _ Alias "NetRemoteTOD" _ (ByVal UncServerName As String, _ BufferPtr As Long) _ As Long Private Declare Sub sapiCopyMemory Lib "kernel32" _ Alias "RtlMoveMemory" _ (hpvDest As Any, _ hpvSource As Any, _ ByVal cbCopy As Long)Public Function fGetServerTime(ByVal strServer As String) As String'*******************************************'Name: fGetServerTime [NT ONLY] (Function)'Purpose: Returns Time of Day for NT Server'Calls: NetRemoteTOD, RtlMoveMemory'Inputs: Name of NT Server in \\ServerName format'Returns: Time of day for the NT Server'*******************************************On Error GoTo ErrHandlerDim tSvrTime As TIME_OF_DAY_INFO, lngRet As LongDim lngPtr As LongDim strOut As StringDim intHoursDiff As IntegerDim intMinsDiff As Integer If Not Left$(strServer, 2) = "\\" Then _ Err.Raise vbObjectError + 5000 strServer = StrConv(strServer, vbUnicode) lngRet = apiNetRemoteTOD(strServer, lngPtr) If Not lngRet = 0 Then Err.Raise vbObjectError + 5001 Call sapiCopyMemory(tSvrTime, ByVal lngPtr, Len(tSvrTime)) With tSvrTime intHoursDiff = .tod_timezone \ 60 intMinsDiff = .tod_timezone Mod 60 strOut = .tod_month & "/" & .tod_day & "/" _ & .tod_year & " " If .tod_hours > 12 Then strOut = strOut & Format(.tod_hours - 12 - intHoursDiff, "00") _ & ":" & Format$(.tod_mins - intMinsDiff, "00") & ":" _ & Format$(.tod_secs, "00") & " PM" Else strOut = strOut & Format(.tod_hours - intHoursDiff, "00") _ & ":" & Format$(.tod_mins - intMinsDiff, "00") & ":" _ & Format$(.tod_secs, "00") & " AM" End If End With fGetServerTime = strOutExitHere: Exit FunctionErrHandler: fGetServerTime = vbNullString Resume ExitHereEnd Function[%sig%]
Cordialement

Stéphane Maillard
Avatar de l’utilisateur
Stephane Maillard
Lord of DominoArea
Lord of DominoArea
 
Message(s) : 8695
Inscrit(e) le : 16 Déc 2004 à 01:10
Localisation : Bretagne

Re: pb sur @Now

Messagepar Droad » 22 Juil 2003 à 12:04

Tu peux essayer qlq chose comme ça:Dim doc As New NotesDocument(NotesDatabaseSurLeServeur)nowServer = doc.Created[%sig%]
Droad
 

Re: pb sur @Now

Messagepar Stephane Maillard » 22 Juil 2003 à 17:33

Bonsoir,Avoir si cela fonctionne sur votre environnement :Const wAPIModule = "NNOTES" ' Windows/32Declare Function ClientGetServerTIMEDATE Lib wAPIModule Alias "ClientGetServerTIMEDATE" _( Byval hDB As Long, T As Long) As IntegerDeclare Function ConvertTIMEDATEToText Lib wAPIModule Alias "ConvertTIMEDATEToText" _( Byval zI As Long, Byval zT As Long, T As Long, Byval S As String, Byval nS As Integer, nT As Integer) As IntegerDeclare Private Function NSFDbOpen Lib wAPIModule Alias "NSFDbOpen" _( Byval PathName As String, DbHandle As Long) As IntegerDeclare Private Function NSFDbClose Lib wAPIModule Alias "NSFDbClose" _( Byval DbHandle As Long) As IntegerDeclare Private Function NSFGetServerLatency Lib wAPIModule Alias "NSFGetServerLatency" _( Byval S As String, Byval T As Long, Byval zL0 As Long, L1 As Long, Byval zV As Integer) As IntegerDeclare Private Function OSPathNetConstruct Lib wAPIModule Alias "OSPathNetConstruct" _( Byval NullPort As Long, Byval Server As String, Byval FIle As String, Byval PathNet As String) As IntegerSub Postopen(Source As Notesuidatabase)H = Evaluate({@LocationGetInfo([HomeServer])})If Not Isarray(H) Then Exit SubIf H(0) = "" Then Exit Subp$ = Space(512)OSPathNetConstruct 0, H(0), "", p$Dim hDB As LongNSFDbOpen p$, hDBIf hDB = 0 Then Exit SubNSFGetServerLatency H(0), 0, 0, w&, 0Dim T(1) As LongClientGetServerTIMEDATE hDB, T(0)d$ = Space(81)ConvertTIMEDATEToText 0, 0, T(0), d$, 80, nd%Dim N As New NotesDateTime(d$)N.AdjustSecond Round(w& / 1000, 0)Time = N.TimeOnlyDate = N.DateOnlyNSFDbClose hDBPrint "Clock set from " & H(0) & " at " & N.TimeOnly & " on " & N.DateOnlyEnd Sub A mettre dans le script de la base.[%sig%]
Cordialement

Stéphane Maillard
Avatar de l’utilisateur
Stephane Maillard
Lord of DominoArea
Lord of DominoArea
 
Message(s) : 8695
Inscrit(e) le : 16 Déc 2004 à 01:10
Localisation : Bretagne

Re: pb sur @Now

Messagepar Stephane Maillard » 24 Juil 2003 à 07:39

Bonjour,Alors, qu'est ce que cela donne ?[%sig%]
Cordialement

Stéphane Maillard
Avatar de l’utilisateur
Stephane Maillard
Lord of DominoArea
Lord of DominoArea
 
Message(s) : 8695
Inscrit(e) le : 16 Déc 2004 à 01:10
Localisation : Bretagne

Re: pb sur @Now

Messagepar asx9 » 24 Juil 2003 à 08:14

je n'ai pas encore essayé car Droad m'a donné une autre solution que je teste depuis hier. il faut dire qu'avec ma très jeune expérience de développeur Lotus Notes (3 mois), j'ai un peu de mal à déchiffrer le code que tu m'a donné. Mais je compte bien le tester avant ce we. D'ailleurs je n'ai pas le choix je termine mon stage dans 2 semaines et il faut que je fasse mon rapport et mes cahiers de maintenance.Merci pour ton aide je te tiendrai au couranta+asx9
asx9
 

Re: pb sur @Now

Messagepar Stephane Maillard » 24 Juil 2003 à 08:16

Bonjour,Bonne fin de stage.[%sig%]
Cordialement

Stéphane Maillard
Avatar de l’utilisateur
Stephane Maillard
Lord of DominoArea
Lord of DominoArea
 
Message(s) : 8695
Inscrit(e) le : 16 Déc 2004 à 01:10
Localisation : Bretagne


Retour vers Développement