Getting Time Stamp

Post

Posted
Rating:
#1 (In Topic #2029)
Regular
cage is in the usergroup ‘Regular’

How to get a files time stamp

How do you get the time stamp of a file that was copied to another drive to verify the file was updated on the drive it was copied to? For example I copy a file from my home drive to a USB stick. I want to display the time stamp of the file on the USB stick to insure the the file was updated. Thanks in advance.
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’
gbWilly leads the usergroup ‘GambOS Contributor’
gbWilly is in the usergroup ‘Blogger’

cage said

How do you get the time stamp of a file
Have a look at the stat function :  https://gambaswiki.org/wiki/lang/stat
And some more on Stat here: https://gambaswiki.org/wiki/comp/gb/stat

That should get you there, if not let us know.. :thumbs:

 

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#3
Regular
cage is in the usergroup ‘Regular’
Thank you sir that works like a charm.  One problem is now I get a complition error when I try to make an executeable. You wouldn't happen to know where I can find out what that error is or where that information is stored?  Normally I can find the problem but this time I am stumpt. 
Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’
gbWilly leads the usergroup ‘GambOS Contributor’
gbWilly is in the usergroup ‘Blogger’

cage said

Thank you sir that works like a charm.  One problem is now I get a complition error when I try to make an executable

Do you mean that an 'Compile All' in IDE and running the application from IDE works. But,when creating an executable it won't compile, and so no executable is made?

You think Stat is causing this? If so, what happens if you comment that line and make an executable, does that work?
If not, Stat is not the cause and without any more info I'm lost in what could cause this.


 

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#5
Regular
cage is in the usergroup ‘Regular’
Yeah Stat is causing the problem althought it does compile. Fist thing I did try was commenting it out and no warnings when compilied. Program works no problem just get the compiliation warrning when I compile it. I think that mybe it may be just a bug in gambas.  I did try using stat three differn ways but it always stat compilied with that warning.  Really want to thank you for you help in this matter. By the way I am using version 3.21.2 so I don't know if it is the same on the older versions or not.
Online now: No Back to the top

Post

Posted
Rating:
#6
Avatar
Administrator
gbWilly is in the usergroup ‘unknown’
gbWilly leads the usergroup ‘GambOS Contributor’
gbWilly is in the usergroup ‘Blogger’

cage said

Program works no problem just get the compiliation warrning when I compile it. I think that mybe it may be just a bug in gambas.  I did try using stat three differn ways but it always stat compilied with that warning.  Really want to thank you for you help in this matter. By the way I am using version 3.21.2 so I don't know if it is the same on the older versions or not.
So, all works, it's just warnings, no errors. Is that what you mean?
And what exact warnings to you get, that might shed a light on the matter as these warnings might come from outside Gambas.
Jjust like you often see when using the toolkits (gtk or qt) you sometimes see gtk or qt warnings in console, that come from underlying mechanisms that Gambas interfaces with.
The gambas version shouldn't make any difference IMHO.

 

gbWilly
- Gambas Dutch translator
- Gambas wiki content contributor
- Gambas debian/ubuntu package recipe contributor
- GambOS, a distro for learning Gambas and more…
- Gambas3 Debian/Ubuntu repositories


… there is always a Catch if things go wrong!
Online now: No Back to the top

Post

Posted
Rating:
#7
Regular
cage is in the usergroup ‘Regular’
Yes everything works fine but the error message reads: There are compilations Warrnings!
Normally when I get that error there was something I forgot to remove from the code but in this instance there is nothing in the code that's not suppose to be there.
This the part of the code that is causing the problems but I am using QT5 not GTK.

Message.Title = "File Status"
Message.Info("<b>MODIFIED DATE: " & Stat(tbDest.Text &/ filename).LastModified)

 
Online now: No Back to the top

Post

Posted
Rating:
#8
Avatar
Enthusiast
Gianluigi is in the usergroup ‘Enthusiast’
Gianluigi is in the usergroup ‘GambOS Contributor’
Hi cage

it doesn't happen here:

Code

Public Sub Form_Open()

  Dim sPath As String = User.Home &/ "A.html" ' <--- There is a file with this name in my home folder

  Message.Title = "File Status"
  If Exist(sPath) Then Message.Info("<b>MODIFIED DATE: " & Stat(sPath).LastModified)
  Me.Close

End

 :goodbye:
Online now: No Back to the top

Post

Posted
Rating:
#9
Regular
cage is in the usergroup ‘Regular’
It must be because I am using a varible pat instead of a literal path.  I will see if that is the case.  Thanks.
Online now: No Back to the top

Post

Posted
Rating:
Item has a rating of 5 (Liked by gbWilly)
#10
Regular
cage is in the usergroup ‘Regular’
Turns out that it was using the litteral file path was causing the problem. When I assigned the litteral path to a varible it compiled without the warning.  So now I need only to assign a litteral path to a varible to fix the problem.:)
Online now: No Back to the top

Post

Posted
Rating:
Item has a rating of 5 (Liked by sholzy)
#11
Avatar
Expert
Quincunxian is in the usergroup ‘Expert’
Quincunxian is in the usergroup ‘Blogger’
Compiler warnings are very useful.

When you select Project > Compile All from the Gambas GUI main menu, the compiler will halt if it finds a serious error and highlight the code.

'Non-serious' warnings are for programming errors / oversites where you may have for example:
  • Declared a variable but it is not used in code.
  • You have overwritten a previously declared global variable. ( Private Wiget as string - then later in a subroutine , Dim Wiget as string)
  • You have a subroutine or function that appears in your code but is never used.
Selection_003.png

  If you double-click on the 'Warnings' tab you will get this.

Selection_004.png

If you then 'double-click on a specific line, the editor should open that block of code and highlight the variable in question.
Fix as required. 

The examples above come from a Games (multiple) that I'm redesigning, hence so many compiler errors :$


 

Cheers - Quin.
I code therefore I am
Online now: No Back to the top

Post

Posted
Rating:
#12
Regular
cage is in the usergroup ‘Regular’
Thank you sir I will rember that the next time I run into that problem.  At least now I have solved the problem with my code.  :)
Online now: No Back to the top
1 guest and 0 members have just viewed this.