The Chicago Police and Fire departments — which together spent nearly $200 million on overtime last year — are finally coming out of the Dark Ages when it comes to employee time-keeping.

Mayor Rahm Emanuel’s administration has awarded a $594,000 contract to GMS Consulting to implement an “automated time and attendance system” that uses biometrics in the Police Department.

The Fire Department’s transition to electronic time-keeping was handled in-house and completed late last month.

Police personnel will not be “fully enrolled” until the end of 2018.

The transition requires city staffers to enter each employee’s timekeeping identification number into the system, then biometrically enroll each sworn officer and civilian employee at their home clock at the beginning or end of their shift.

The Department of Finance also must train more than 30 timekeepers and hundreds of supervisors — including 1,200 sergeants, 275 lieutenants, 36 captains and 48 commanders — on how to enter furlough and other paid time off and how to run manpower and overtime reports as needed.

The process is time-consuming because police employees represent nearly half of the city workforce and they’re spread out across many locations and multiple shifts.

When the painstaking process is finally completed, it will “increase accountability” and pave the way for “real-time tracking of attendance, including overtime,” said Molly Poppe, a spokeswoman for the city’s Office of Budget and Management.

“This will allow CPD and CFD to better track its officers and sworn personnel work time and absenteeism, and identify overtime trends quicker, so it can be addressed immediately,” Poppe wrote in an email.

The Chicago Sun-Times reported earlier this year that the Police and Fire departments together amassed a record $193.5 million in total overtime in 2016.

That includes $143 million for the Police Department alone, an increase of 23 percent from the record total of the year before.

Most of the police overtime stemmed from the department’s response to a 60 percent surge in homicides and shootings in 2016 compared to the previous year.

In July 2016 alone, the police department paid out $21.6 million in overtime, more than double June spending. As the death toll climbed to levels not seen in two decades, Emanuel ended years of retrenchment and proposed a two-year hiring surge that would add 970 officers over and above attrition.

The vast majority of overtime tied to the Cubs’ march to their first World Series title in 108 years also came in the police department: $17.2 million.

The Fire Department spent $50.5 million on overtime — 66 percent over its allotted budget for 2016 — with the largest totals going to paramedics.

For years, the Police and Fire departments were the only city departments still using a paper system for tracking hours worked.

“We need to put them on the city’s main time-keeping system so we can have a centralized record. Everybody swipes. We know when people show up to work. We know when people leave. It allows the city … to better manage the police and fire workforce,” retiring Budget Director Alex Holt has said.

The electronic time-keeping system uses biometric time clocks and “hand geometry technology.” Employees swipe their identification badges, then put their hands on a palm reader that reads their fingerprints.

Without that system, Holt was asked how taxpayers can be certain police overtime hours billed were legitimately worked.

“The Police Department does keep track of time. They do some auditing of that time. We’ve also got some double-checks on what we pay out. But you’re right. It would be better and it would be easier to track and we’d have an easier time of auditing that information if we actually had them in the centralized time-keeping system,” she has said.

The switch to electronic time-keeping for the two hold-out departments is part of a citywide crackdown on absenteeism with a $10 million price tag.

A report on chronic absenteeism also recommended that the city adopt a “common working definition” of absenteeism across all city departments critical to “tracking, policy-making and effective discipline.”

An “excused absence” must meet several conditions: sufficient notice to and approval by a supervisor; a reason “acceptable” to that supervisor and sufficient accrued paid time off to cover that absence unless otherwise compensated for things like jury duty, administrative, family or bereavement leave, or duty disability.

Other recommendations included developing a comprehensive swiping policy, streamlining attendance codes, establishing a dashboard that publicly displays lost work-time rates and trends for each city department, reforming and streamlining progressive discipline for absenteeism and providing departments with “actionable monthly reports” that identify absenteeism by employees and holding mangers accountable for fair and consistent enforcement.

The report also called for increased training for both employees and supervisors.

The Departments of Streets and Sanitation and Fleet Management have used all of those measures and more to reduce what was once chronic absenteeism. Now, those two departments lead the city with the lowest absenteeism rates, 4.5 percent and 3.5 percent, respectively.

Every year, up to 7 percent of the time that should have been worked by city employees is lost to absenteeism. Up to 15 percent of that is what Holt calls “overt absenteeism.”