In the governance contract, https://docs.openzeppelin.com/contracts/4.x/governance, votingDelay and votingPeriod are set manually as number of blocks corresponding to the time of approximately one day or one week. However, in the future, the block producing speed may change after network updates. And an automatically set number based on average block producing speed can be more suitable in various voting scenarios.
Solidity can calculate the average block producing speed based on timestamps and block numbers. However, can it get the speed directly?