flat assembler
Message board for the users of flat assembler.

Author
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17849
revolution
Code:
```__currenttime         =%t
__yearday            =__yearseconds/86400
__yeardaytemp           =__yearday
if (__yeardaytemp>=(59+__leapyear))
__yeardaytemp         =__yeardaytemp+3-__leapyear
end if
if (__yeardaytemp>=123)
__yeardaytemp          =__yeardaytemp+1
end if
if (__yeardaytemp>=185)
__yeardaytemp             =__yeardaytemp+1
end if
if (__yeardaytemp>=278)
__yeardaytemp             =__yeardaytemp+1
end if
if (__yeardaytemp>=340)
__yeardaytemp             =__yeardaytemp+1
end if
__month           =__yeardaytemp/31+1
__day            =__yeardaytemp-__month*31+32
__dayseconds    =__yearseconds-__yearday*86400
__hour                =__dayseconds/3600
__hourseconds     =__dayseconds-__hour*3600
__minute   =__hourseconds/60
__second   =__hourseconds-__minute*60

__stringyear  equ (__year/1000+'0'),((__year mod 1000)/100+'0'),\
((__year mod 100)/10+'0'),((__year mod 10)+'0')
__stringmonth        equ (__month/10+'0'),((__month mod 10)+'0')
__stringday  equ (__day/10+'0'),((__day mod 10)+'0')
__stringhour     equ (__hour/10+'0'),((__hour mod 10)+'0')
__stringminute equ (__minute/10+'0'),((__minute mod 10)+'0')
__stringsecond     equ (__second/10+'0'),((__second mod 10)+'0')

db      'Last build: '
db      __stringyear,'/',__stringmonth,'/',__stringday,' '
db      __stringhour,':',__stringminute,':',__stringsecond,' GMT'
```
17 Nov 2004, 08:37

Joined: 25 Sep 2003
Posts: 2140
Location: Estonia
There are just some strings, but what if I want to put them in some exe's properties (in the version tab I mean). I think they'd have to be separated.

Another suggestion - shouldn't the name and the beginning of copyright be configurable
like:
Code:
```__author equ 'TheBiggestAndTheGreatest'
__beginyear equ '2001'
;...
;...
```

Now you can put it in an include and let the author and beginyear be easily changable.

EDIT:
Fixed db to equ
Thanks to vid for noticing

Last edited by Madis731 on 17 Nov 2004, 15:06; edited 1 time in total
17 Nov 2004, 10:14
vid
Verbosity in development

Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
that won't work, because "db 'Copyright',__author"will insert address of 'TheBiggestAndTheGreatest' string behind 'Copyright' bytes, not the string. You should use something like:
Code:
```__author equ 'TheBiggestAndTheGreatest'
```
17 Nov 2004, 10:53
pelaillo
Missing in inaction

Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo
Useful indeed

Thanks revolution.
17 Nov 2004, 13:14
Matrix

Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
But copyright is not forever, and uses system clock right?
17 Nov 2004, 23:42
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17849
revolution
Copyrights in most countries last until 50 after the authors death. But check with your local office before taking my word for it.

If your system clock is wrong then of course the dates and times above will also be wrong.

Don't forget about the wrap around at 31 bits and/or 32 bits. Respectively 2038/01/19 03:14:08 and 2106/02/07 06:28:16.

However the calculation will be wrong after 2100-02-28 because 2100 is not a leap year.
18 Nov 2004, 02:28
revolution
When all else fails, read the source

Joined: 24 Aug 2004
Posts: 17849
revolution
You can use the strings in your exe properties also.

For example see the FASMW.ASM
Code:
```  version version_info,VOS__WINDOWS32,VFT_APP,VFT2_UNKNOWN,LANG_ENGLISH+SUBLANG_DEFAULT,0,\
'FileDescription','flat assembler',\
'FileVersion',IDE_VERSION_STRING,\
'ProductVersion',VERSION_STRING,\
'OriginalFilename','FASMW.EXE'
```

you can replace 2004 with ',__stringyear,'
18 Nov 2004, 02:37
Matrix

Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
i'd recommend this :

or