"Many people visit Facebook as the first thing in the morning and the last thing before going to bed. It is, therefore, possible to get a good impression of their sleeping habits," said San Francisco-based software engineer Soren Louv-Jansen in a Mail Online report.
For the study, Louv-Jansen used "time stamps" from Facebook's Messenger service to see when his friends were asleep.
He was curious to see where the "last seen" data was coming from and after doing some research, he found a list of his Facebook friends' user IDs and last activity "time stamps".
This, he added, is embedded in the initial mark-up of Messenger.com and can be viewed by simply visiting the website and clicking "View Source" to see for yourself.
"By creating a simple service that checks Facebook every 10 minutes, I'm able to get an accurate picture of my friends' Facebook usage," said Louv-Jansen, who published the programme's source code onto GitHub.
GitHub is used by many developers and hackers to put large amounts of information for developer communities to see and take advantage of, the report said.
For the latest tech news and reviews, follow Gadgets 360 on X, Facebook, WhatsApp, Threads and Google News. For the latest videos on gadgets and tech, subscribe to our YouTube channel. If you want to know everything about top influencers, follow our in-house Who'sThat360 on Instagram and YouTube.