On December 31.1878 ; Karl Benz, working in Mannheim, Germany, filed for a patent on his first reliable two-stroke gas engine, and he was granted the patent in 1879.