Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Pete Sass
  Where is Pete Sass?
 Marathon, Ontario
 Canada
 Pete Sass
 To: Dan Baker
  Where is Dan Baker?
 Effort of the Poconos
 Pennsylvania - United States
 Dan Baker
 Tags
Subject: RE: How does SCX TimeStamp get computed?
Thread ID: 416100 Message ID: 416105 # Views: 64 # Ratings: 4
Version: Visual FoxPro 9 Category: Forms
Date: Sunday, December 21, 2014 6:59:56 PM         
   


> Foxites,
>
> I want to have some version control for the objects in my form and
> I thought it best to use the timestamp and code in the SCX as the reference.
>
> What I figure on doing is have the main.prg of MyProject, do a COPY FILE
> of the SCX into MyProjectFormBackUp.DBF.
>
> Then I would use this new file to extract the code and timestamp information
> from the copied SCX.  Is this procedure safe and sound practice?
>
> And I can't figure out how SCX calculates the TimeStamp.  It looks like the timestamp
> is based on the form's creation Datetime. It also appears the TimeStamp for the Data Environment
> object remains constant and the Form object is timestamped with every new save of the form. 
> Any control that is changed in the current design time session gets a new timestamp.
>
> Appreciate the help.  Dan B.



Hi Dan,

Never tackled things down to the granular level, but my first kick at the cat would
be to open the ProjectName.pjx and obtain the timestamp values against whatever you would
want to check date and times against.

You could of course obtain the information out of the PRJ file via a SQL Select statement.
SELECT * FROM TextSearch.pjx INTO CURSOR curProjName && Where TextSearch is the project name.
SELECT curProjName
Browse

OK now you need to enumerate the timestamp field data in the project in order to compare the datetime
stamp against maybe your last backup date, so anything newer would be tagged for backup.

The following function will take the project's timestamp numeric value and convert it into a readable
datetime stamp value you can use - lol
The conversion converts into the DD/MM/YY format with a military time on the end.

ps.. at this point I do not recall where this code came from. I know a few years back I made some
changes to it as if all follows my coding styles, but I do not thing I wrote the original version and
cannot give credit the person who original coded this.

* --- TsToDate.prg
* --- CALLING SYNTAX:  <variable> = TSToDate(<nTimeStamp>,<cStyle>)
* --- EXAMPLE       :  cDateTime  = TsToDate(TimeStamp,"DATETIME")

*************************************************
PARAMETER nTimeStamp, cStyle
PRIVATE cRetVal   

* --- Timestamp check.
IF TYPE('nTimeStamp') != "N"
  WAIT WINDOW "Time stamp you passed to me is not numeric."
  RETURN ""
ENDIF  

IF nTimeStamp = 0
  RETURN "No TimeStamp?"
ENDIF

* --- Default return style to both date and time.
IF TYPE('cStyle') != "C"
  cStyle = "DATETIME"
ENDIF

IF !INLIST(UPPER(cStyle),"DATE","TIME","DATETIME")
  WAIT WINDOW "Style must be passed as" + "DATE, TIME, or DATETIME"
ENDIF

nYear   = ((nTimeStamp/(2**25) + 1980))
nMonth  = ((nYear-INT(nYear)    )*(2**25))/ (2**21)
nDay    = ((nMonth-INT(nMonth)  )*(2**21))/ (2**16)
nHour   = ((nDay-INT(nDay)      )*(2**16))/ (2**11)
nMinute = ((nHour-INT(nHour)    )*(2**11))/ (2**05)
nSecond = ((nMinute-INT(nMinute))*(2**05))* 2

cRetVal = ""

IF "DATE" $ UPPER(cStyle)  
  cRetVal = cRetVal + RIGHT("0"+ALLTRIM(STR(INT(nMonth))),2) + "/" + RIGHT("0"+ALLTRIM(STR(INT(nDay))),2) + "/" + RIGHT("0"+ALLTRIM(STR(INT(nYear))),2)
ENDIF

IF "TIME" $ UPPER(cStyle)
  cRetVal = cRetVal + IIF("DATE" $ UPPER(cStyle), " ", "")
  cRetVal = cRetVal + RIGHT("0"+ALLTRIM(STR(INT(nHour))),2) + ":" + RIGHT("0"+ALLTRIM(STR(INT(nMinute))),2) + ":" + RIGHT("0"+ALLTRIM(STR(INT(nSecond))),2)
ENDIF
RETURN cRetVal




Pete "the IceMan", from the Great White North of Canada.
www.marathongriffincomputers.com

ENTIRE THREAD

How does SCX TimeStamp get computed? Posted by Dan Baker @ 12/21/2014 4:37:08 PM
RE: How does SCX TimeStamp get computed? Posted by Pete Sass @ 12/21/2014 6:59:56 PM
RE: How does SCX TimeStamp get computed? Posted by Dan Baker @ 12/21/2014 11:41:09 PM
RE: How does SCX TimeStamp get computed? Posted by Pete Sass @ 12/22/2014 12:09:50 AM
RE: How does SCX TimeStamp get computed? Posted by Fernando Bozzo @ 12/21/2014 9:08:48 PM
RE: How does SCX TimeStamp get computed? Posted by Dan Baker @ 12/22/2014 12:45:44 AM
RE: How does SCX TimeStamp get computed? Posted by Greg Green @ 12/21/2014 9:19:59 PM
RE: How does SCX TimeStamp get computed? Posted by Dan Baker @ 12/22/2014 12:52:17 AM
RE: How does SCX TimeStamp get computed? Posted by Greg Green @ 12/22/2014 7:44:39 AM
RE: How does SCX TimeStamp get computed? Posted by Dan Baker @ 12/23/2014 12:11:44 AM
RE: How does SCX TimeStamp get computed? Posted by Jun Tangunan @ 12/22/2014 12:54:11 AM
RE: How does SCX TimeStamp get computed? Posted by Mustapha Bihmouten @ 12/22/2014 2:59:24 PM
RE: How does SCX TimeStamp get computed? Posted by Dan Baker @ 12/22/2014 3:10:42 PM