f:file
d:date
t:time
f.CREATE('c:\test');
f.close;
getstamp('c:\test',d,t);
MESSAGE('%1\%2',
format(CURRENTDATETIME,0,'<Hours,2>:<Minutes,2>:<Seconds,2>:<Thousands,3>'),
format(CREATEDATETIME(d,t),0,'<Hours,2>:<Minutes,2>:<Seconds,2>:<Thousands,3>'));
If you run this you will find that the file is always created in the future... Okay, so it's only between half a second and two seconds, but it's in the future nonetheless.
Any brilliant minds out there that can explain this?
Brian Rocatis
Senior NAV Developer
Elbek & Vejrup
0
Comments
09:38:23:283
09:38:23:279
Looks fine to me on rtc.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I'm getting too old for this shit :roll:
Senior NAV Developer
Elbek & Vejrup
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Senior NAV Developer
Elbek & Vejrup
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
(And to be pedantic: the date returned is undefined because you never wrote anything to the file: )
On NTFS with NAV 2009 R2 Classic I get
Use GETSTAMP on any file on your system and you will get a wrong time (compared to what the file properties window will tell you in Explorer). It's just a bit hard to see because the time stamp in Explorer is only shown down to the second. No. Creating a file also sets the modified date/time. The file is still modified in the future.. Did you run the test multiple times? And if so, was the displacement the same every time? I could sort of accept it if the time stamp was just rounded up to the nearest second, but that's not the case either I just did a couple of tests:
17:50:34:021
17:50:36:000
17:50:56:816
17:50:58:000
It's never more than 2 seconds though :-k
Senior NAV Developer
Elbek & Vejrup
You are assuming that GETSTAMP returns the modified date of the file. But that is not what the documentation of that function says. It does not deny it either. The documentation in the C/SIDE help and on msdn says: (emphasis mine) GETSTAMP Function (File) - MSDN - Microsoft.
And I said I was being pedantic - to the documentation, that is. The statement was meant to make you think about your expectation in the light of what is promised to you (i.e. documented) concerning this function. Note: nothing is said about the precision of the returned timestamp.
According to GETSTAMP, that is. I didn't claim anything different.
To me it looks like the timestamp is rounded to the next even second (Like or similar to the FAT file system).
Interestingly enough, the "File Times" link you provided says "For example, the resolution of create time on FAT is 10 milliseconds, while write time has a resolution of 2 seconds". But we're not using FAT, and if you view the properties of a file in Explorer the granularity is (at least) 1 second.
Also, doing the test using NAV 2013 tells us that the granularity here is 1/1000s.
My guess is that the GETSTAMP function was rewritten/updated in NAV 2013 to show the actual date/time stamp of the file whereas the function in earlier versions were written to adhere to the way FAT works. This would make sense insofar as NAV was born from FAT - so to speak.
Even so I still think it's weird that the time is rounded up and not down.
Yes, but that's not what the function does. It doesn't make sense that "Last written to" can be in the future (now I'm being pedantic, I know).
I think we're in agreement.
Senior NAV Developer
Elbek & Vejrup