Fix datetime function for generating IDs

Running into ID collision using the gettime() method for trying to generate unique IDs. Instead why not just use a counter to ensure all the IDs are unique?