Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Setting a file's timestamp
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00314025
Message ID:
00314145
Vues:
36
>>>Does anyone know how to explicitly set a files time date stamp from vfp6. I think there used to be a foxtools function called ftouch that did this but it seems to be gone now. If your solution includes using the win32ap setfiletime function plese let me know how to convert from a foxpro datetime to the wierd format that function uses.
>>>
>>>Thanks in advance.
>>>
>>Hi Jacob,
>>
>>There still is a Foxtools function that does this: FoxTouch(). It's usage is described in Q114949 in the MS KB and in my "Extended Foxtools Help" file available here on the UT.
>>
>>One note: There's a known bug. If you fail to indicate the timestamp (it's supposed to default to the current system time) the function stamps the file with the current UTC time for your locale.
>
>
>Thanks for the help it worked fine after I figured out how to translate the offset from the registry.
>
Hi Jay,

You could also get that information from the Bias member of the TIME_ZONE_INFORMATION structure. This is the first four bytes of the structure and can by easily retrieved.
DECLARE INTEGER GetTimeZoneInformation IN Win32API;
  STRING @lpTimeZoneInformation
lctimezone = REPLICATE(CHR(0), 172)
= GetTimeZoneInformation(@lctimezone)
* The number of minutes
lnbias = StringToInteger(LEFT(lctimezone, 4))

FUNCTION StringToInteger

  LPARAMETER pcstring, plsigned
    
  LOCAL lnresult, lnlast, lni, llsigned,;
    lnmsb, lnmax
  lnresult = 0
  lnlast = LEN(pcstring)
  * Return Signed Integer?
  IF PCOUNT() = 2
    llsigned = plsigned
  ELSE
    llsigned = .F.
  ENDIF
  FOR lni = 1 TO lnlast
    lnresult = lnresult + ASC(SUBSTR(pcstring, lni, 1)) * (256 ^ (lni - 1))
  NEXT
  IF llsigned
    lnmsb = (lnlast * 8) - 1
    IF BITTEST(lnresult, lnmsb)
      lnmax = (2 ^ (lnmsb + 1))
      lnresult = lnresult - lnmax
    ENDIF
  ENDIF
  RETURN lnresult
ENDFUNC
George

Ubi caritas et amor, deus ibi est
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform