flat assembler
Message board for the users of flat assembler.
  
       
      Index
      > Main > how to get date and time during compilation | 
  
| Author | 
  | 
              
| 
                  
                   edfed 14 Jun 2011, 20:53 
                  the easy way would be to do it by hand, with a pencil on a sheet of paper.
 
                  
                for the hard way, i don't have ideas, wait for experts to have a better answer. all in all, i like my answer, i find it cool.  | 
              |||
                  
  | 
              
| 
                  
                   typedef 14 Jun 2011, 20:54 
                  Using windows...
 
                  Code: _st SYSTEMTIME push _st call [GetLocalTime] mov eax,_st [eax+SYSTEMTIME.wDay] => Day | ie Monday, Tuesday..etc [eax+SYSTEMTIME.wDate] => Date [eax+SYSTEMTIME.wHour] => Hour .... or [_st.wXXX] --------------------------edited Last edited by typedef on 14 Jun 2011, 23:22; edited 1 time in total  | 
              |||
                  
  | 
              
| 
                  
                   shutdownall 14 Jun 2011, 20:56 
                  Okay typedef, how can windows obtain the compilation date / time of binary compiled by FASM ? 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   vid 14 Jun 2011, 20:58 
                  search the forum, there were several macros for it.
 
                  
                PS: At first I saw topic "how to get date during compilation", then I was disappointed  | 
              |||
                  
  | 
              
| 
                  
                   shutdownall 14 Jun 2011, 21:04 
                  okay for any non specific date you can try http://www.dia.com 
                  
                 | 
              |||
                  
  | 
              
| 
                  
                   cod3b453 14 Jun 2011, 22:01 
                  You can use the built in %t timestamp:
 
                  
                Code: _t = %t _t_s = _t mod 60 _t_m = ((_t - _t_s) / 60) mod 60 _t_h = ((_t - (_t_m * 60) - _t_s) / 3600) mod 24 db '0'+(_t_h / 10) db '0'+(_t_h mod 10) db ':' db '0'+(_t_m / 10) db '0'+(_t_m mod 10) db ':' db '0'+(_t_s / 10) db '0'+(_t_s mod 10)  | 
              |||
                  
  | 
              
| 
                  
                   bitshifter 14 Jun 2011, 22:09 
                  typedef wrote: Using windows... Sorry to interfere but i must correct your code... 1) st is reserved FPU register, it must have new name (eg: _st) 2) Name goes before struct type (eg: _st SYSTEMTIME) 3) No need to use EAX (eg: [_st.wDay] is simpler) Just thought i would help (to keep OP from chasing ghosts) _________________ Coding a 3D game engine with fasm is like trying to eat an elephant, you just have to keep focused and take it one 'byte' at a time.  | 
              |||
                  
  | 
              
| 
                  
                   shutdownall 14 Jun 2011, 22:26 
                  cod3b453 wrote: You can use the built in %t timestamp: Thank you for that code snippet. I tried myself with %t. Is not comfortable because have to write own macro but now I have following problem. My computer dumps out date/time at GMT. There is a difference of 2 hours to Berlin time because of other timezone and DST (daylight saving time) active. So my computer writes 14.06.2011 22:25:00. Of course when I look at my PC clock it is 15.06.2011 00:25:00 Any idea to solve this problem ? Should I open a new thread with this more specific problem ?  | 
              |||
                  
  | 
              
| 
                  
                   cod3b453 14 Jun 2011, 22:34 
                  You'd have to manually adjust the timestamp to your time zone and "daylight saving time" state. You can do this by simple arithmetic: 
 
                  
                Code: _t = %t + (+2 * 3600)  | 
              |||
                  
  | 
              
| 
                  
                   shutdownall 14 Jun 2011, 23:03 
                  Okay but what happen when DST switched off ?
 
                  
                I now how I can manipulate data but thought there would be a more comfortable way.  | 
              |||
                  
  | 
              
| 
                  
                   typedef 14 Jun 2011, 23:19 
                  bitshifter wrote: 
 Thank you bitshifter... I knew all that but I forgot because I just came HLL programming...lol you can see the way I declared system time I forgot it's var DATA_TYPE In C/C++/Java you know it's data_type var... Sorry for that confusion and thank you bitshifter  | 
              |||
                  
  | 
              
| 
                  
                   typedef 14 Jun 2011, 23:23 
                  shutdownall wrote: Okay typedef, how can windows obtain the compilation date / time of binary compiled by FASM ? GetFileTime | http://msdn.microsoft.com/en-us/library/ms724320%28v=vs.85%29.aspx ?  | 
              |||
                  
  | 
              
| 
                  
                   LocoDelAssembly 15 Jun 2011, 02:31 
                  shutdownall, wouldn't be better to just stick with the GMT time (which is DST invariant)? The reason I have against local time is that when transitioning from DST back to normal time zone there are 60 minutes of a day that occurs twice, so you could end up with a latest compilation being "older" than a previous one (unless you add to your format a DST indicator). 
                  
                 | 
              |||
                  
  | 
              
< Last Thread | Next Thread >  | 
    
Forum Rules: 
  | 
    
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.