It is probably not possible with a snippet, however I wrote a plugin to accomplish what you want. In Sublime, click Tools > New Plugin. Replace the example code with the following. Name it "add_license_stamp.py" and save it in your Packages folder (not in Packages/User). Also, add a keybinding in your keymap file. To run the command, place your cursor where you want it and press the keybinding:
Keybinding:
{ "keys": ["ctrl+shift+9"], "command": "add_license_stamp" }
Plugin:
import sublime, sublime_plugin
import os
import datetime
import random
import getpass
''' Add license stamp
/**
* @version $Id: ${1:current_file_name.extension} ${2:random_4_digit_number} ${3:YYYY-MM-DD} ${4:time_in_UTC_24} ${5:current_logged-in_user} $
* @author Company http://example.com
* @copyright Copyright (C) 2007 - ${6:current_year} Company
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
*/
'''
class AddLicenseStampCommand(sublime_plugin.TextCommand):
def run(self, edit):
company_name = "BobCo"
company_site = "http://bobco.com"
file_path = self.view.file_name()
file_name = os.path.basename(file_path)
year = datetime.datetime.utcnow().strftime("%Y")
date_time = datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S UTC")
random_number = str(random.randrange(0000, 9999)).zfill(4)
user = getpass.getuser()
license = "/**\n"
license += "* @version $Id: " + file_name + " " + random_number + " " + date_time + " " + user + " $\n"
license += "* @author " + company_name + " " + company_site + "\n"
license += "* @copyright Copyright (C) 2007 - " + year + " " + company_name + "\n"
license += "* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only\n"
license += "*/\n"
self.view.replace(edit, self.view.sel()[0], license)
(note: python requires a blank line after your code)
Replace "BobCo" with your company name. I'm not sure of the best way to get the current user name, I used this question: Is there a portable way to get the current username in Python? . They say it is compatible with the major OSes. If not do something similar to how I did the company name. And manually set it per user. Also, I don't know what UTC 24-hour format is. But I just used the time in 24 hour format.
Edit
I changed now() to utcnow() to get the utc date/time. I added date/time formatting. I added zfill(4) to the random number to pad it with zeros if under 4 digits. You can highlight the current stamp and hit the key binding to update it. You could also get fancy and automatically replace on save, but beyond the current scope. You would have to use a regex to find the current stamp. Then activate the script upon save instead of run.